lib/fastly/api/contact_api.rb in fastly-5.3.1 vs lib/fastly/api/contact_api.rb in fastly-6.0.0
- old
+ new
@@ -15,9 +15,99 @@
attr_accessor :api_client
def initialize(api_client = ApiClient.default)
@api_client = api_client
end
+ # Add a new customer contact
+ # Create a contact.
+ # @option opts [String] :customer_id Alphanumeric string identifying the customer. (required)
+ # @option opts [String] :user_id The alphanumeric string representing the user for this customer contact.
+ # @option opts [String] :contact_type The type of contact.
+ # @option opts [String] :name The name of this contact, when user_id is not provided.
+ # @option opts [String] :email The email of this contact, when a user_id is not provided.
+ # @option opts [String] :phone The phone number for this contact. Required for primary, technical, and security contact types.
+ # @option opts [String] :customer_id The alphanumeric string representing the customer for this customer contact.
+ # @return [ContactResponse]
+ def create_contacts(opts = {})
+ data, _status_code, _headers = create_contacts_with_http_info(opts)
+ data
+ end
+
+ # Add a new customer contact
+ # Create a contact.
+ # @option opts [String] :customer_id Alphanumeric string identifying the customer. (required)
+ # @option opts [String] :user_id The alphanumeric string representing the user for this customer contact.
+ # @option opts [String] :contact_type The type of contact.
+ # @option opts [String] :name The name of this contact, when user_id is not provided.
+ # @option opts [String] :email The email of this contact, when a user_id is not provided.
+ # @option opts [String] :phone The phone number for this contact. Required for primary, technical, and security contact types.
+ # @option opts [String] :customer_id The alphanumeric string representing the customer for this customer contact.
+ # @return [Array<(ContactResponse, Integer, Hash)>] ContactResponse data, response status code and response headers
+ def create_contacts_with_http_info(opts = {})
+ if @api_client.config.debugging
+ @api_client.config.logger.debug 'Calling API: ContactApi.create_contacts ...'
+ end
+ # unbox the parameters from the hash
+ customer_id = opts[:'customer_id']
+ # verify the required parameter 'customer_id' is set
+ if @api_client.config.client_side_validation && customer_id.nil?
+ fail ArgumentError, "Missing the required parameter 'customer_id' when calling ContactApi.create_contacts"
+ end
+ allowable_values = ["primary", "billing", "technical", "security", "emergency", "general compliance"]
+ if @api_client.config.client_side_validation && opts[:'contact_type'] && !allowable_values.include?(opts[:'contact_type'])
+ fail ArgumentError, "invalid value for \"contact_type\", must be one of #{allowable_values}"
+ end
+ # resource path
+ local_var_path = '/customer/{customer_id}/contacts'.sub('{' + 'customer_id' + '}', CGI.escape(customer_id.to_s))
+
+ # query parameters
+ query_params = opts[:query_params] || {}
+
+ # header parameters
+ header_params = opts[:header_params] || {}
+ # HTTP header 'Accept' (if needed)
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
+ # HTTP header 'Content-Type'
+ content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])
+ if !content_type.nil?
+ header_params['Content-Type'] = content_type
+ end
+
+ # form parameters
+ form_params = opts[:form_params] || {}
+ form_params['user_id'] = opts[:'user_id'] if !opts[:'user_id'].nil?
+ form_params['contact_type'] = opts[:'contact_type'] if !opts[:'contact_type'].nil?
+ form_params['name'] = opts[:'name'] if !opts[:'name'].nil?
+ form_params['email'] = opts[:'email'] if !opts[:'email'].nil?
+ form_params['phone'] = opts[:'phone'] if !opts[:'phone'].nil?
+ form_params['customer_id'] = opts[:'customer_id'] if !opts[:'customer_id'].nil?
+
+ # http body (model)
+ post_body = opts[:debug_body]
+
+ # return_type
+ return_type = opts[:debug_return_type] || 'ContactResponse'
+
+ # auth_names
+ auth_names = opts[:debug_auth_names] || ['token']
+
+ new_options = opts.merge(
+ :operation => :"ContactApi.create_contacts",
+ :header_params => header_params,
+ :query_params => query_params,
+ :form_params => form_params,
+ :body => post_body,
+ :auth_names => auth_names,
+ :return_type => return_type
+ )
+
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
+ if @api_client.config.debugging
+ @api_client.config.logger.debug "API called: ContactApi#create_contacts\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
+ end
+ return data, status_code, headers
+ end
+
# Delete a contact
# Delete a contact.
# @option opts [String] :customer_id Alphanumeric string identifying the customer. (required)
# @option opts [String] :contact_id An alphanumeric string identifying the customer contact. (required)
# @return [InlineResponse200]