|
| 1 | +=begin |
| 2 | +#Associations |
| 3 | +
|
| 4 | +#Associations define the relationships between objects in HubSpot. These endpoints allow you to create, read, and remove associations. |
| 5 | +
|
| 6 | +The version of the OpenAPI document: v3 |
| 7 | +
|
| 8 | +Generated by: https://openapi-generator.tech |
| 9 | +OpenAPI Generator version: 6.2.1 |
| 10 | +
|
| 11 | +=end |
| 12 | + |
| 13 | +require 'cgi' |
| 14 | + |
| 15 | +module Hubspot |
| 16 | + module Crm |
| 17 | + module Associations |
| 18 | + module Schema |
| 19 | + class TypesApi |
| 20 | + attr_accessor :api_client |
| 21 | + |
| 22 | + def initialize(api_client = ApiClient.default) |
| 23 | + @api_client = api_client |
| 24 | + end |
| 25 | + # List association types |
| 26 | + # List all the valid association types available between two object types |
| 27 | + # @param from_object_type [String] |
| 28 | + # @param to_object_type [String] |
| 29 | + # @param [Hash] opts the optional parameters |
| 30 | + # @return [CollectionResponsePublicAssociationDefinitionNoPaging] |
| 31 | + def get_all(from_object_type, to_object_type, opts = {}) |
| 32 | + data, _status_code, _headers = get_all_with_http_info(from_object_type, to_object_type, opts) |
| 33 | + data |
| 34 | + end |
| 35 | + |
| 36 | + # List association types |
| 37 | + # List all the valid association types available between two object types |
| 38 | + # @param from_object_type [String] |
| 39 | + # @param to_object_type [String] |
| 40 | + # @param [Hash] opts the optional parameters |
| 41 | + # @return [Array<(CollectionResponsePublicAssociationDefinitionNoPaging, Integer, Hash)>] CollectionResponsePublicAssociationDefinitionNoPaging data, response status code and response headers |
| 42 | + def get_all_with_http_info(from_object_type, to_object_type, opts = {}) |
| 43 | + if @api_client.config.debugging |
| 44 | + @api_client.config.logger.debug 'Calling API: TypesApi.get_all ...' |
| 45 | + end |
| 46 | + # verify the required parameter 'from_object_type' is set |
| 47 | + if @api_client.config.client_side_validation && from_object_type.nil? |
| 48 | + fail ArgumentError, "Missing the required parameter 'from_object_type' when calling TypesApi.get_all" |
| 49 | + end |
| 50 | + # verify the required parameter 'to_object_type' is set |
| 51 | + if @api_client.config.client_side_validation && to_object_type.nil? |
| 52 | + fail ArgumentError, "Missing the required parameter 'to_object_type' when calling TypesApi.get_all" |
| 53 | + end |
| 54 | + # resource path |
| 55 | + local_var_path = '/crm/v3/associations/{fromObjectType}/{toObjectType}/types'.sub('{' + 'fromObjectType' + '}', CGI.escape(from_object_type.to_s)).sub('{' + 'toObjectType' + '}', CGI.escape(to_object_type.to_s)) |
| 56 | + |
| 57 | + # query parameters |
| 58 | + query_params = opts[:query_params] || {} |
| 59 | + |
| 60 | + # header parameters |
| 61 | + header_params = opts[:header_params] || {} |
| 62 | + # HTTP header 'Accept' (if needed) |
| 63 | + header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/*']) |
| 64 | + |
| 65 | + # form parameters |
| 66 | + form_params = opts[:form_params] || {} |
| 67 | + |
| 68 | + # http body (model) |
| 69 | + post_body = opts[:debug_body] |
| 70 | + |
| 71 | + # return_type |
| 72 | + return_type = opts[:debug_return_type] || 'CollectionResponsePublicAssociationDefinitionNoPaging' |
| 73 | + |
| 74 | + # auth_names |
| 75 | + auth_names = opts[:debug_auth_names] || ['hapikey', 'oauth2'] |
| 76 | + |
| 77 | + new_options = opts.merge( |
| 78 | + :operation => :"TypesApi.get_all", |
| 79 | + :header_params => header_params, |
| 80 | + :query_params => query_params, |
| 81 | + :form_params => form_params, |
| 82 | + :body => post_body, |
| 83 | + :auth_names => auth_names, |
| 84 | + :return_type => return_type |
| 85 | + ) |
| 86 | + |
| 87 | + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) |
| 88 | + if @api_client.config.debugging |
| 89 | + @api_client.config.logger.debug "API called: TypesApi#get_all\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" |
| 90 | + end |
| 91 | + return data, status_code, headers |
| 92 | + end |
| 93 | + end |
| 94 | + end |
| 95 | + end |
| 96 | + end |
| 97 | +end |
0 commit comments