Class: Late::AccountsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/late-sdk/api/accounts_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ AccountsApi

Returns a new instance of AccountsApi.



19
20
21
# File 'lib/late-sdk/api/accounts_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/late-sdk/api/accounts_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#delete_account(account_id, opts = {}) ⇒ DeleteAccountGroup200Response

Disconnect account Disconnects and removes a connected social account.

Parameters:

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

    the optional parameters

Returns:



27
28
29
30
# File 'lib/late-sdk/api/accounts_api.rb', line 27

def (, opts = {})
  data, _status_code, _headers = (, opts)
  data
end

#delete_account_with_http_info(account_id, opts = {}) ⇒ Array<(DeleteAccountGroup200Response, Integer, Hash)>

Disconnect account Disconnects and removes a connected social account.

Parameters:

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

    the optional parameters

Returns:



37
38
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
# File 'lib/late-sdk/api/accounts_api.rb', line 37

def (, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AccountsApi.delete_account ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling AccountsApi.delete_account"
  end
  # resource path
  local_var_path = '/v1/accounts/{accountId}'.sub('{' + 'accountId' + '}', CGI.escape(.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']) unless header_params['Accept']

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'DeleteAccountGroup200Response'

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

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

#get_account_health(account_id, opts = {}) ⇒ GetAccountHealth200Response

Check account health Returns detailed health info for a specific account including token status, permissions, and recommendations.

Parameters:

  • account_id (String)

    The account ID to check

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

    the optional parameters

Returns:



90
91
92
93
# File 'lib/late-sdk/api/accounts_api.rb', line 90

def (, opts = {})
  data, _status_code, _headers = (, opts)
  data
end

#get_account_health_with_http_info(account_id, opts = {}) ⇒ Array<(GetAccountHealth200Response, Integer, Hash)>

Check account health Returns detailed health info for a specific account including token status, permissions, and recommendations.

Parameters:

  • account_id (String)

    The account ID to check

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

    the optional parameters

Returns:

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

    GetAccountHealth200Response data, response status code and response headers



100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
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
# File 'lib/late-sdk/api/accounts_api.rb', line 100

def (, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AccountsApi.get_account_health ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling AccountsApi.get_account_health"
  end
  # resource path
  local_var_path = '/v1/accounts/{accountId}/health'.sub('{' + 'accountId' + '}', CGI.escape(.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']) unless header_params['Accept']

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'GetAccountHealth200Response'

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

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

#get_all_accounts_health(opts = {}) ⇒ GetAllAccountsHealth200Response

Check accounts health Returns health status of all connected accounts including token validity, permissions, and issues needing attention.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :profile_id (String)

    Filter by profile ID

  • :platform (String)

    Filter by platform

  • :status (String)

    Filter by health status

Returns:



155
156
157
158
# File 'lib/late-sdk/api/accounts_api.rb', line 155

def get_all_accounts_health(opts = {})
  data, _status_code, _headers = get_all_accounts_health_with_http_info(opts)
  data
end

#get_all_accounts_health_with_http_info(opts = {}) ⇒ Array<(GetAllAccountsHealth200Response, Integer, Hash)>

Check accounts health Returns health status of all connected accounts including token validity, permissions, and issues needing attention.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :profile_id (String)

    Filter by profile ID

  • :platform (String)

    Filter by platform

  • :status (String)

    Filter by health status

Returns:



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
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
# File 'lib/late-sdk/api/accounts_api.rb', line 167

def get_all_accounts_health_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AccountsApi.get_all_accounts_health ...'
  end
  allowable_values = ["facebook", "instagram", "linkedin", "twitter", "tiktok", "youtube", "threads", "pinterest", "reddit", "bluesky", "googlebusiness", "telegram", "snapchat"]
  if @api_client.config.client_side_validation && opts[:'platform'] && !allowable_values.include?(opts[:'platform'])
    fail ArgumentError, "invalid value for \"platform\", must be one of #{allowable_values}"
  end
  allowable_values = ["healthy", "warning", "error"]
  if @api_client.config.client_side_validation && opts[:'status'] && !allowable_values.include?(opts[:'status'])
    fail ArgumentError, "invalid value for \"status\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/v1/accounts/health'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'profileId'] = opts[:'profile_id'] if !opts[:'profile_id'].nil?
  query_params[:'platform'] = opts[:'platform'] if !opts[:'platform'].nil?
  query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'GetAllAccountsHealth200Response'

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

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

#get_follower_stats(opts = {}) ⇒ GetFollowerStats200Response

Get follower stats Returns follower count history and growth metrics for connected social accounts. Requires analytics add-on subscription. Follower counts are refreshed once per day.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :account_ids (String)

    Comma-separated list of account IDs (optional, defaults to all user&#39;s accounts)

  • :profile_id (String)

    Filter by profile ID

  • :from_date (Date)

    Start date in YYYY-MM-DD format (defaults to 30 days ago)

  • :to_date (Date)

    End date in YYYY-MM-DD format (defaults to today)

  • :granularity (String)

    Data aggregation level (default to ‘daily’)

Returns:



231
232
233
234
# File 'lib/late-sdk/api/accounts_api.rb', line 231

def get_follower_stats(opts = {})
  data, _status_code, _headers = get_follower_stats_with_http_info(opts)
  data
end

#get_follower_stats_with_http_info(opts = {}) ⇒ Array<(GetFollowerStats200Response, Integer, Hash)>

Get follower stats Returns follower count history and growth metrics for connected social accounts. Requires analytics add-on subscription. Follower counts are refreshed once per day.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :account_ids (String)

    Comma-separated list of account IDs (optional, defaults to all user&#39;s accounts)

  • :profile_id (String)

    Filter by profile ID

  • :from_date (Date)

    Start date in YYYY-MM-DD format (defaults to 30 days ago)

  • :to_date (Date)

    End date in YYYY-MM-DD format (defaults to today)

  • :granularity (String)

    Data aggregation level (default to ‘daily’)

Returns:

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

    GetFollowerStats200Response data, response status code and response headers



245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
# File 'lib/late-sdk/api/accounts_api.rb', line 245

def get_follower_stats_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AccountsApi.get_follower_stats ...'
  end
  allowable_values = ["daily", "weekly", "monthly"]
  if @api_client.config.client_side_validation && opts[:'granularity'] && !allowable_values.include?(opts[:'granularity'])
    fail ArgumentError, "invalid value for \"granularity\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/v1/accounts/follower-stats'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'accountIds'] = opts[:'account_ids'] if !opts[:'account_ids'].nil?
  query_params[:'profileId'] = opts[:'profile_id'] if !opts[:'profile_id'].nil?
  query_params[:'fromDate'] = opts[:'from_date'] if !opts[:'from_date'].nil?
  query_params[:'toDate'] = opts[:'to_date'] if !opts[:'to_date'].nil?
  query_params[:'granularity'] = opts[:'granularity'] if !opts[:'granularity'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'GetFollowerStats200Response'

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

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

#list_accounts(opts = {}) ⇒ ListAccounts200Response

List accounts Returns connected social accounts. Only includes accounts within the plan limit by default. Follower data requires analytics add-on.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :profile_id (String)

    Filter accounts by profile ID

  • :platform (String)

    Filter accounts by platform (e.g. &quot;instagram&quot;, &quot;twitter&quot;).

  • :include_over_limit (Boolean)

    When true, includes accounts from over-limit profiles. (default to false)

Returns:



305
306
307
308
# File 'lib/late-sdk/api/accounts_api.rb', line 305

def list_accounts(opts = {})
  data, _status_code, _headers = list_accounts_with_http_info(opts)
  data
end

#list_accounts_with_http_info(opts = {}) ⇒ Array<(ListAccounts200Response, Integer, Hash)>

List accounts Returns connected social accounts. Only includes accounts within the plan limit by default. Follower data requires analytics add-on.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :profile_id (String)

    Filter accounts by profile ID

  • :platform (String)

    Filter accounts by platform (e.g. &quot;instagram&quot;, &quot;twitter&quot;).

  • :include_over_limit (Boolean)

    When true, includes accounts from over-limit profiles. (default to false)

Returns:

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

    ListAccounts200Response data, response status code and response headers



317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
# File 'lib/late-sdk/api/accounts_api.rb', line 317

def list_accounts_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AccountsApi.list_accounts ...'
  end
  # resource path
  local_var_path = '/v1/accounts'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'profileId'] = opts[:'profile_id'] if !opts[:'profile_id'].nil?
  query_params[:'platform'] = opts[:'platform'] if !opts[:'platform'].nil?
  query_params[:'includeOverLimit'] = opts[:'include_over_limit'] if !opts[:'include_over_limit'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'ListAccounts200Response'

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

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

#update_account(account_id, update_account_request, opts = {}) ⇒ UpdateAccount200Response

Update account Updates a connected social account’s display name or username override.

Parameters:

  • account_id (String)
  • update_account_request (UpdateAccountRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



370
371
372
373
# File 'lib/late-sdk/api/accounts_api.rb', line 370

def (, , opts = {})
  data, _status_code, _headers = (, , opts)
  data
end

#update_account_with_http_info(account_id, update_account_request, opts = {}) ⇒ Array<(UpdateAccount200Response, Integer, Hash)>

Update account Updates a connected social account&#39;s display name or username override.

Parameters:

  • account_id (String)
  • update_account_request (UpdateAccountRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

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

    UpdateAccount200Response data, response status code and response headers



381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
# File 'lib/late-sdk/api/accounts_api.rb', line 381

def (, , opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AccountsApi.update_account ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling AccountsApi.update_account"
  end
  # verify the required parameter 'update_account_request' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'update_account_request' when calling AccountsApi.update_account"
  end
  # resource path
  local_var_path = '/v1/accounts/{accountId}'.sub('{' + 'accountId' + '}', CGI.escape(.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']) unless header_params['Accept']
  # 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()

  # return_type
  return_type = opts[:debug_return_type] || 'UpdateAccount200Response'

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

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