Class: Pipedrive::SearchResultsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/pipedrive-openapi-client/api/search_results_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ SearchResultsApi

Returns a new instance of SearchResultsApi.



19
20
21
# File 'lib/pipedrive-openapi-client/api/search_results_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/pipedrive-openapi-client/api/search_results_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#search_results_field_get(term, field_type, field_key, opts = {}) ⇒ nil

Perform a search using a specific field value <strong>This endpoint is deprecated. Please use <a href="developers.pipedrive.com/docs/api/v1/#!/ItemSearch/get_itemSearch_field">/v1/itemSearch/field</a> instead</strong>.
Performs a search from a specific field’s values. Results can be either the distinct values of the field (useful for searching autocomplete field values), or actual items IDs (deals, persons, organizations or products).

Parameters:

  • term (String)

    Search term to look for, minimum 2 characters.

  • field_type (String)

    Type of the field to perform the search from.

  • field_key (String)

    Key of the field to search from. Field key can be obtained by fetching the list of fields using any of fields API GET methods (dealFields, personFields, ..).

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :exact_match (NumberBoolean)

    When enabled, only full exact matches against the given term are returned. By default, term can be present anywhere in the resulting field values to be considered a match. The minimum 2 character limit for the term is discarded when exact_match is enabled.

  • :return_field_key (String)

    Name of the field in search results from which the search was performed. When omitted, &#39;value&#39; will be used. You may want to set this parameter to match the field_key.

  • :return_item_ids (NumberBoolean)

    Whether to return matching items IDs in search results. When omitted or set to 0, only distinct values of the searched field are returned. When enabled, the return_field_key parameter is ignored and the results include the searched field as its own key.

  • :start (Integer)

    Pagination start (default to 0)

  • :limit (Integer)

    Items shown per page

Returns:

  • (nil)


34
35
36
37
# File 'lib/pipedrive-openapi-client/api/search_results_api.rb', line 34

def search_results_field_get(term, field_type, field_key, opts = {})
  search_results_field_get_with_http_info(term, field_type, field_key, opts)
  nil
end

#search_results_field_get_with_http_info(term, field_type, field_key, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Perform a search using a specific field value &lt;strong&gt;This endpoint is deprecated. Please use &lt;a href&#x3D;&quot;developers.pipedrive.com/docs/api/v1/#!/ItemSearch/get_itemSearch_field&quot;&gt;/v1/itemSearch/field&lt;/a&gt; instead&lt;/strong&gt;. &lt;br&gt; Performs a search from a specific field&#39;s values. Results can be either the distinct values of the field (useful for searching autocomplete field values), or actual items IDs (deals, persons, organizations or products).

Parameters:

  • term (String)

    Search term to look for, minimum 2 characters.

  • field_type (String)

    Type of the field to perform the search from.

  • field_key (String)

    Key of the field to search from. Field key can be obtained by fetching the list of fields using any of fields API GET methods (dealFields, personFields, ..).

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :exact_match (NumberBoolean)

    When enabled, only full exact matches against the given term are returned. By default, term can be present anywhere in the resulting field values to be considered a match. The minimum 2 character limit for the term is discarded when exact_match is enabled.

  • :return_field_key (String)

    Name of the field in search results from which the search was performed. When omitted, &#39;value&#39; will be used. You may want to set this parameter to match the field_key.

  • :return_item_ids (NumberBoolean)

    Whether to return matching items IDs in search results. When omitted or set to 0, only distinct values of the searched field are returned. When enabled, the return_field_key parameter is ignored and the results include the searched field as its own key.

  • :start (Integer)

    Pagination start

  • :limit (Integer)

    Items shown per page

Returns:

  • (Array<(nil, Integer, Hash)>)

    nil, response status code and response headers



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/pipedrive-openapi-client/api/search_results_api.rb', line 51

def search_results_field_get_with_http_info(term, field_type, field_key, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SearchResultsApi.search_results_field_get ...'
  end
  # verify the required parameter 'term' is set
  if @api_client.config.client_side_validation && term.nil?
    fail ArgumentError, "Missing the required parameter 'term' when calling SearchResultsApi.search_results_field_get"
  end
  # verify the required parameter 'field_type' is set
  if @api_client.config.client_side_validation && field_type.nil?
    fail ArgumentError, "Missing the required parameter 'field_type' when calling SearchResultsApi.search_results_field_get"
  end
  # verify enum value
  allowable_values = ["dealField", "personField", "organizationField", "productField"]
  if @api_client.config.client_side_validation && !allowable_values.include?(field_type)
    fail ArgumentError, "invalid value for \"field_type\", must be one of #{allowable_values}"
  end
  # verify the required parameter 'field_key' is set
  if @api_client.config.client_side_validation && field_key.nil?
    fail ArgumentError, "Missing the required parameter 'field_key' when calling SearchResultsApi.search_results_field_get"
  end
  # resource path
  local_var_path = '/searchResults/field'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'term'] = term
  query_params[:'field_type'] = field_type
  query_params[:'field_key'] = field_key
  query_params[:'exact_match'] = opts[:'exact_match'] if !opts[:'exact_match'].nil?
  query_params[:'return_field_key'] = opts[:'return_field_key'] if !opts[:'return_field_key'].nil?
  query_params[:'return_item_ids'] = opts[:'return_item_ids'] if !opts[:'return_item_ids'].nil?
  query_params[:'start'] = opts[:'start'] if !opts[:'start'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?

  # header parameters
  header_params = opts[:header_params] || {}

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  # return_type
  return_type = opts[:return_type] 

  # auth_names
  auth_names = opts[:auth_names] || ['api_key', 'oauth2']

  new_options = opts.merge(
    :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(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: SearchResultsApi#search_results_field_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#search_results_get(term, opts = {}) ⇒ nil

Perform a search <strong>This endpoint is deprecated. Please use <a href="developers.pipedrive.com/docs/api/v1/#!/ItemSearch/get_itemSearch">/v1/itemSearch</a> instead</strong>.
Performs a search across the account and returns SearchResults.

Parameters:

  • term (String)

    Search term to look for, minimum 2 characters.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :item_type (String)

    Search for items of exact type. If omitted, all types of items are searched.

  • :start (Integer)

    Pagination start (default to 0)

  • :limit (Integer)

    Items shown per page

  • :exact_match (NumberBoolean)

    When enabled, only full exact matches against the given term are returned. The minimum 2 character limit for the term is discarded when exact_match is enabled. It will only work if search term is 30 characters or less.

Returns:

  • (nil)


126
127
128
129
# File 'lib/pipedrive-openapi-client/api/search_results_api.rb', line 126

def search_results_get(term, opts = {})
  search_results_get_with_http_info(term, opts)
  nil
end

#search_results_get_with_http_info(term, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Perform a search &lt;strong&gt;This endpoint is deprecated. Please use &lt;a href&#x3D;&quot;developers.pipedrive.com/docs/api/v1/#!/ItemSearch/get_itemSearch&quot;&gt;/v1/itemSearch&lt;/a&gt; instead&lt;/strong&gt;. &lt;br&gt; Performs a search across the account and returns SearchResults.

Parameters:

  • term (String)

    Search term to look for, minimum 2 characters.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :item_type (String)

    Search for items of exact type. If omitted, all types of items are searched.

  • :start (Integer)

    Pagination start

  • :limit (Integer)

    Items shown per page

  • :exact_match (NumberBoolean)

    When enabled, only full exact matches against the given term are returned. The minimum 2 character limit for the term is discarded when exact_match is enabled. It will only work if search term is 30 characters or less.

Returns:

  • (Array<(nil, Integer, Hash)>)

    nil, response status code and response headers



140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
# File 'lib/pipedrive-openapi-client/api/search_results_api.rb', line 140

def search_results_get_with_http_info(term, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SearchResultsApi.search_results_get ...'
  end
  # verify the required parameter 'term' is set
  if @api_client.config.client_side_validation && term.nil?
    fail ArgumentError, "Missing the required parameter 'term' when calling SearchResultsApi.search_results_get"
  end
  allowable_values = ["deal", "person", "organization", "product", "file"]
  if @api_client.config.client_side_validation && opts[:'item_type'] && !allowable_values.include?(opts[:'item_type'])
    fail ArgumentError, "invalid value for \"item_type\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/searchResults'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'term'] = term
  query_params[:'item_type'] = opts[:'item_type'] if !opts[:'item_type'].nil?
  query_params[:'start'] = opts[:'start'] if !opts[:'start'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'exact_match'] = opts[:'exact_match'] if !opts[:'exact_match'].nil?

  # header parameters
  header_params = opts[:header_params] || {}

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  # return_type
  return_type = opts[:return_type] 

  # auth_names
  auth_names = opts[:auth_names] || ['api_key', 'oauth2']

  new_options = opts.merge(
    :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(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: SearchResultsApi#search_results_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end