Class: KlaviyoBeta::ClientApi

Inherits:
Object
  • Object
show all
Defined in:
lib/klaviyo_sdk_beta/api/client_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ ClientApi

Returns a new instance of ClientApi.



19
20
21
# File 'lib/klaviyo_sdk_beta/api/client_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/klaviyo_sdk_beta/api/client_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#create_client_event(company_id, event_create_query, opts = {}) ⇒ Hash<String, Object>

Create Client Event "Enqueue an event to be created. This creates an event asynchronously. On successful queueing, this returns a 202 status code with an empty body. A sucessful response does not guarantee the event was created successfully. If the event is malformed or does not abide by limits, the event will be rejected qith status code of 400.
*Rate limits*:
Burst: `350/s`
Steady: `3500/m`

Parameters:

  • company_id (String)
  • event_create_query (EventCreateQuery)

    Event to create.

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

    the optional parameters

Returns:

  • (Hash<String, Object>)


28
29
30
31
# File 'lib/klaviyo_sdk_beta/api/client_api.rb', line 28

def create_client_event(company_id, event_create_query, opts = {})
  data, _status_code, _headers = create_client_event_with_http_info(company_id, event_create_query, opts)
  data
end

#create_client_event_with_http_info(company_id, event_create_query, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)>

Create Client Event &quot;Enqueue an event to be created. This creates an event asynchronously. On successful queueing, this returns a 202 status code with an empty body. A sucessful response does not guarantee the event was created successfully. If the event is malformed or does not abide by limits, the event will be rejected qith status code of 400.&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;350/s&#x60;&lt;br&gt;Steady: &#x60;3500/m&#x60;

Parameters:

  • company_id (String)
  • event_create_query (EventCreateQuery)

    Event to create.

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

    the optional parameters

Returns:

  • (Array<(Hash<String, Object>, Integer, Hash)>)

    Hash<String, Object> data, response status code and response headers



39
40
41
42
43
44
45
46
47
48
49
50
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
# File 'lib/klaviyo_sdk_beta/api/client_api.rb', line 39

def create_client_event_with_http_info(company_id, event_create_query, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ClientApi.create_client_event ...'
  end
  # verify the required parameter 'company_id' is set
  if @api_client.config.client_side_validation && company_id.nil?
    fail ArgumentError, "Missing the required parameter 'company_id' when calling ClientApi.create_client_event"
  end
  # verify the required parameter 'event_create_query' is set
  if @api_client.config.client_side_validation && event_create_query.nil?
    fail ArgumentError, "Missing the required parameter 'event_create_query' when calling ClientApi.create_client_event"
  end
  # resource path
  local_var_path = '/client/events/'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'company_id'] = company_id

  # header parameters
  header_params = opts[:header_params] || {}
  # klaviyo api revision
  header_params['revision'] =  ENV['API_REVISION'] || "2022-09-07.pre"
  # 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/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

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

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(event_create_query)

  # return_type
  return_type = opts[:debug_return_type] || 'Hash<String, Object>'

  # auth_names
  auth_names = opts[:debug_auth_names] || []

  new_options = opts.merge(
    :operation => :"ClientApi.create_client_event",
    :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: ClientApi#create_client_event\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_client_profile(company_id, onsite_profile_create_query, opts = {}) ⇒ Hash<String, Object>

Create Client Profile Create/Update Profiles objects (replaces /identify)
*Rate limits*:
Burst: `350/s`
Steady: `3500/m`

Parameters:

  • company_id (String)
  • onsite_profile_create_query (OnsiteProfileCreateQuery)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Hash<String, Object>)


105
106
107
108
# File 'lib/klaviyo_sdk_beta/api/client_api.rb', line 105

def create_client_profile(company_id, onsite_profile_create_query, opts = {})
  data, _status_code, _headers = create_client_profile_with_http_info(company_id, onsite_profile_create_query, opts)
  data
end

#create_client_profile_with_http_info(company_id, onsite_profile_create_query, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)>

Create Client Profile Create/Update Profiles objects (replaces /identify)&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;350/s&#x60;&lt;br&gt;Steady: &#x60;3500/m&#x60;

Parameters:

  • company_id (String)
  • onsite_profile_create_query (OnsiteProfileCreateQuery)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(Hash<String, Object>, Integer, Hash)>)

    Hash<String, Object> data, response status code and response headers



116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
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
# File 'lib/klaviyo_sdk_beta/api/client_api.rb', line 116

def create_client_profile_with_http_info(company_id, onsite_profile_create_query, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ClientApi.create_client_profile ...'
  end
  # verify the required parameter 'company_id' is set
  if @api_client.config.client_side_validation && company_id.nil?
    fail ArgumentError, "Missing the required parameter 'company_id' when calling ClientApi.create_client_profile"
  end
  # verify the required parameter 'onsite_profile_create_query' is set
  if @api_client.config.client_side_validation && onsite_profile_create_query.nil?
    fail ArgumentError, "Missing the required parameter 'onsite_profile_create_query' when calling ClientApi.create_client_profile"
  end
  # resource path
  local_var_path = '/client/profiles/'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'company_id'] = company_id

  # header parameters
  header_params = opts[:header_params] || {}
  # klaviyo api revision
  header_params['revision'] =  ENV['API_REVISION'] || "2022-09-07.pre"
  # 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/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

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

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(onsite_profile_create_query)

  # return_type
  return_type = opts[:debug_return_type] || 'Hash<String, Object>'

  # auth_names
  auth_names = opts[:debug_auth_names] || []

  new_options = opts.merge(
    :operation => :"ClientApi.create_client_profile",
    :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: ClientApi#create_client_profile\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_client_subscription(company_id, onsite_subscription_create_query, opts = {}) ⇒ Hash<String, Object>

Create Client Subscription Create a new subscription for the given list
*Rate limits*:
Burst: `100/s`
Steady: `100/m`

Parameters:

Returns:

  • (Hash<String, Object>)


182
183
184
185
# File 'lib/klaviyo_sdk_beta/api/client_api.rb', line 182

def create_client_subscription(company_id, onsite_subscription_create_query, opts = {})
  data, _status_code, _headers = create_client_subscription_with_http_info(company_id, onsite_subscription_create_query, opts)
  data
end

#create_client_subscription_with_http_info(company_id, onsite_subscription_create_query, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)>

Create Client Subscription Create a new subscription for the given list&lt;br&gt;&lt;br&gt;*Rate limits*:&lt;br&gt;Burst: &#x60;100/s&#x60;&lt;br&gt;Steady: &#x60;100/m&#x60;

Parameters:

Returns:

  • (Array<(Hash<String, Object>, Integer, Hash)>)

    Hash<String, Object> data, response status code and response headers



193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
# File 'lib/klaviyo_sdk_beta/api/client_api.rb', line 193

def create_client_subscription_with_http_info(company_id, onsite_subscription_create_query, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ClientApi.create_client_subscription ...'
  end
  # verify the required parameter 'company_id' is set
  if @api_client.config.client_side_validation && company_id.nil?
    fail ArgumentError, "Missing the required parameter 'company_id' when calling ClientApi.create_client_subscription"
  end
  # verify the required parameter 'onsite_subscription_create_query' is set
  if @api_client.config.client_side_validation && onsite_subscription_create_query.nil?
    fail ArgumentError, "Missing the required parameter 'onsite_subscription_create_query' when calling ClientApi.create_client_subscription"
  end
  # resource path
  local_var_path = '/client/subscriptions/'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'company_id'] = company_id

  # header parameters
  header_params = opts[:header_params] || {}
  # klaviyo api revision
  header_params['revision'] =  ENV['API_REVISION'] || "2022-09-07.pre"
  # 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/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

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

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(onsite_subscription_create_query)

  # return_type
  return_type = opts[:debug_return_type] || 'Hash<String, Object>'

  # auth_names
  auth_names = opts[:debug_auth_names] || []

  new_options = opts.merge(
    :operation => :"ClientApi.create_client_subscription",
    :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: ClientApi#create_client_subscription\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end