Class: PluralKitAPI::SystemsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/pluralkit-api/api/systems_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ SystemsApi

Returns a new instance of SystemsApi.



19
20
21
# File 'lib/pluralkit-api/api/systems_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/pluralkit-api/api/systems_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#a_id_get(id, opts = {}) ⇒ System

Gets a system by (one of) its associated Discord accounts. Note that it’s currently not possible to get a system’s registered accounts given a system ID through the API. Consider this endpoint "one-way".

Parameters:

  • id (String)

    A Discord user ID.

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

    the optional parameters

Returns:



27
28
29
30
# File 'lib/pluralkit-api/api/systems_api.rb', line 27

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

#a_id_get_with_http_info(id, opts = {}) ⇒ Array<(System, Integer, Hash)>

Gets a system by (one of) its associated Discord accounts. Note that it&#39;s currently not possible to get a system&#39;s registered accounts given a system ID through the API. Consider this endpoint &quot;one-way&quot;.

Parameters:

  • id (String)

    A Discord user ID.

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

    the optional parameters

Returns:

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

    System data, response status code and response headers



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
84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/pluralkit-api/api/systems_api.rb', line 37

def a_id_get_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SystemsApi.a_id_get ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling SystemsApi.a_id_get"
  end
  if @api_client.config.client_side_validation && id.to_s.length > 19
    fail ArgumentError, 'invalid value for "id" when calling SystemsApi.a_id_get, the character length must be smaller than or equal to 19.'
  end

  if @api_client.config.client_side_validation && id.to_s.length < 17
    fail ArgumentError, 'invalid value for "id" when calling SystemsApi.a_id_get, the character length must be great than or equal to 17.'
  end

  pattern = Regexp.new(/^[0-9]{17,19}/)
  if @api_client.config.client_side_validation && id !~ pattern
    fail ArgumentError, "invalid value for 'id' when calling SystemsApi.a_id_get, must conform to the pattern #{pattern}."
  end

  # resource path
  local_var_path = '/a/{id}'.sub('{' + 'id' + '}', CGI.escape(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'])

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

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

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

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

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

#get_own_system(opts = {}) ⇒ System

Returns your own system. Requires authentication, and will returns the system the token belongs to.

Parameters:

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

    the optional parameters

Returns:



102
103
104
105
# File 'lib/pluralkit-api/api/systems_api.rb', line 102

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

#get_own_system_with_http_info(opts = {}) ⇒ Array<(System, Integer, Hash)>

Returns your own system. Requires authentication, and will returns the system the token belongs to.

Parameters:

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

    the optional parameters

Returns:

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

    System data, response status code and response headers



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
147
148
149
150
151
152
153
# File 'lib/pluralkit-api/api/systems_api.rb', line 111

def get_own_system_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SystemsApi.get_own_system ...'
  end
  # resource path
  local_var_path = '/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'])

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

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

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

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

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

#get_system(id, opts = {}) ⇒ System

Gets a system by its ID. Partial information may be returned if not authenticated with this system’s token.

Parameters:

  • id (String)

    The ID of the system in question.

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

    the optional parameters

Returns:



160
161
162
163
# File 'lib/pluralkit-api/api/systems_api.rb', line 160

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

#get_system_fronters(id, opts = {}) ⇒ FullSwitch

Gets a system’s current fronters.

Parameters:

  • id (String)

    The ID of the system in question.

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

    the optional parameters

Returns:



235
236
237
238
# File 'lib/pluralkit-api/api/systems_api.rb', line 235

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

#get_system_fronters_with_http_info(id, opts = {}) ⇒ Array<(FullSwitch, Integer, Hash)>

Gets a system&#39;s current fronters.

Parameters:

  • id (String)

    The ID of the system in question.

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

    the optional parameters

Returns:

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

    FullSwitch data, response status code and response headers



244
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
297
298
299
300
301
302
303
# File 'lib/pluralkit-api/api/systems_api.rb', line 244

def get_system_fronters_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SystemsApi.get_system_fronters ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling SystemsApi.get_system_fronters"
  end
  if @api_client.config.client_side_validation && id.to_s.length > 5
    fail ArgumentError, 'invalid value for "id" when calling SystemsApi.get_system_fronters, the character length must be smaller than or equal to 5.'
  end

  if @api_client.config.client_side_validation && id.to_s.length < 5
    fail ArgumentError, 'invalid value for "id" when calling SystemsApi.get_system_fronters, the character length must be great than or equal to 5.'
  end

  pattern = Regexp.new(/^[a-z]{5}$/)
  if @api_client.config.client_side_validation && id !~ pattern
    fail ArgumentError, "invalid value for 'id' when calling SystemsApi.get_system_fronters, must conform to the pattern #{pattern}."
  end

  # resource path
  local_var_path = '/s/{id}/fronters'.sub('{' + 'id' + '}', CGI.escape(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'])

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

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

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

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

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

#get_system_members(id, opts = {}) ⇒ Array<System>

Gets a system’s members. If the API token does not belong to this system, this list may exclude any private members in the system.

Parameters:

  • id (String)

    The ID of the system in question.

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

    the optional parameters

Returns:



310
311
312
313
# File 'lib/pluralkit-api/api/systems_api.rb', line 310

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

#get_system_members_with_http_info(id, opts = {}) ⇒ Array<(Array<System>, Integer, Hash)>

Gets a system&#39;s members. If the API token does not belong to this system, this list may exclude any private members in the system.

Parameters:

  • id (String)

    The ID of the system in question.

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

    the optional parameters

Returns:

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

    Array<System> data, response status code and response headers



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
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
# File 'lib/pluralkit-api/api/systems_api.rb', line 320

def get_system_members_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SystemsApi.get_system_members ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling SystemsApi.get_system_members"
  end
  if @api_client.config.client_side_validation && id.to_s.length > 5
    fail ArgumentError, 'invalid value for "id" when calling SystemsApi.get_system_members, the character length must be smaller than or equal to 5.'
  end

  if @api_client.config.client_side_validation && id.to_s.length < 5
    fail ArgumentError, 'invalid value for "id" when calling SystemsApi.get_system_members, the character length must be great than or equal to 5.'
  end

  pattern = Regexp.new(/^[a-z]{5}$/)
  if @api_client.config.client_side_validation && id !~ pattern
    fail ArgumentError, "invalid value for 'id' when calling SystemsApi.get_system_members, must conform to the pattern #{pattern}."
  end

  # resource path
  local_var_path = '/s/{id}/members'.sub('{' + 'id' + '}', CGI.escape(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'])

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'Array<System>'

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

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

#get_system_switches(id, opts = {}) ⇒ Array<Switch>

Gets a system’s switch history. Will return the system’s switch history, up to 100 entries at a time, in reverse-chronological (latest first) order. For pagination, see the ‘before` query parameter.

Parameters:

  • id (String)

    The ID of the system in question.

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

    the optional parameters

Options Hash (opts):

  • :before (Time)

    If provided, will only return switches that happened before (and not including) this timestamp. This can be used for pagination by calling the endpoint again with the timestamp of the last switch of the previous response.

Returns:



387
388
389
390
# File 'lib/pluralkit-api/api/systems_api.rb', line 387

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

#get_system_switches_with_http_info(id, opts = {}) ⇒ Array<(Array<Switch>, Integer, Hash)>

Gets a system&#39;s switch history. Will return the system&#39;s switch history, up to 100 entries at a time, in reverse-chronological (latest first) order. For pagination, see the &#x60;before&#x60; query parameter.

Parameters:

  • id (String)

    The ID of the system in question.

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

    the optional parameters

Options Hash (opts):

  • :before (Time)

    If provided, will only return switches that happened before (and not including) this timestamp. This can be used for pagination by calling the endpoint again with the timestamp of the last switch of the previous response.

Returns:

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

    Array<Switch> data, response status code and response headers



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
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
# File 'lib/pluralkit-api/api/systems_api.rb', line 398

def get_system_switches_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SystemsApi.get_system_switches ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling SystemsApi.get_system_switches"
  end
  if @api_client.config.client_side_validation && id.to_s.length > 5
    fail ArgumentError, 'invalid value for "id" when calling SystemsApi.get_system_switches, the character length must be smaller than or equal to 5.'
  end

  if @api_client.config.client_side_validation && id.to_s.length < 5
    fail ArgumentError, 'invalid value for "id" when calling SystemsApi.get_system_switches, the character length must be great than or equal to 5.'
  end

  pattern = Regexp.new(/^[a-z]{5}$/)
  if @api_client.config.client_side_validation && id !~ pattern
    fail ArgumentError, "invalid value for 'id' when calling SystemsApi.get_system_switches, must conform to the pattern #{pattern}."
  end

  # resource path
  local_var_path = '/s/{id}/switches'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'before'] = opts[:'before'] if !opts[:'before'].nil?

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

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'Array<Switch>'

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

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

#get_system_with_http_info(id, opts = {}) ⇒ Array<(System, Integer, Hash)>

Gets a system by its ID. Partial information may be returned if not authenticated with this system&#39;s token.

Parameters:

  • id (String)

    The ID of the system in question.

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

    the optional parameters

Returns:

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

    System data, response status code and response headers



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
221
222
223
224
225
226
227
228
229
# File 'lib/pluralkit-api/api/systems_api.rb', line 170

def get_system_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SystemsApi.get_system ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling SystemsApi.get_system"
  end
  if @api_client.config.client_side_validation && id.to_s.length > 5
    fail ArgumentError, 'invalid value for "id" when calling SystemsApi.get_system, the character length must be smaller than or equal to 5.'
  end

  if @api_client.config.client_side_validation && id.to_s.length < 5
    fail ArgumentError, 'invalid value for "id" when calling SystemsApi.get_system, the character length must be great than or equal to 5.'
  end

  pattern = Regexp.new(/^[a-z]{5}$/)
  if @api_client.config.client_side_validation && id !~ pattern
    fail ArgumentError, "invalid value for 'id' when calling SystemsApi.get_system, must conform to the pattern #{pattern}."
  end

  # resource path
  local_var_path = '/s/{id}'.sub('{' + 'id' + '}', CGI.escape(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'])

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

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

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

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

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

#update_system(system, opts = {}) ⇒ System

Updates an existing system. Requires authentication, and will update the system the token belongs to.

Parameters:

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

    the optional parameters

Returns:



465
466
467
468
# File 'lib/pluralkit-api/api/systems_api.rb', line 465

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

#update_system_with_http_info(system, opts = {}) ⇒ Array<(System, Integer, Hash)>

Updates an existing system. Requires authentication, and will update the system the token belongs to.

Parameters:

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

    the optional parameters

Returns:

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

    System data, response status code and response headers



475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
# File 'lib/pluralkit-api/api/systems_api.rb', line 475

def update_system_with_http_info(system, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SystemsApi.update_system ...'
  end
  # verify the required parameter 'system' is set
  if @api_client.config.client_side_validation && system.nil?
    fail ArgumentError, "Missing the required parameter 'system' when calling SystemsApi.update_system"
  end
  # resource path
  local_var_path = '/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'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

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

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

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

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

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