class PluralKitAPI::SystemsApi
Attributes
Public Class Methods
# File lib/pluralkit-api/api/systems_api.rb, line 19 def initialize(api_client = ApiClient.default) @api_client = api_client end
Public Instance Methods
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". @param id [String] A Discord user ID. @param [Hash] opts the optional parameters @return [System]
# 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
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". @param id [String] A Discord user ID. @param [Hash] opts the optional parameters @return [Array<(System
, Integer, Hash)>] System
data, response status code and response headers
# 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
Returns your own system. Requires authentication, and will returns the system the token belongs to. @param [Hash] opts the optional parameters @return [System]
# 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
Returns your own system. Requires authentication, and will returns the system the token belongs to. @param [Hash] opts the optional parameters @return [Array<(System
, Integer, Hash)>] System
data, response status code and response headers
# 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
Gets a system by its ID. Partial information may be returned if not authenticated with this system's token. @param id [String] The ID of the system in question. @param [Hash] opts the optional parameters @return [System]
# 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
Gets a system's current fronters. @param id [String] The ID of the system in question. @param [Hash] opts the optional parameters @return [FullSwitch]
# 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
Gets a system's current fronters. @param id [String] The ID of the system in question. @param [Hash] opts the optional parameters @return [Array<(FullSwitch
, Integer, Hash)>] FullSwitch
data, response status code and response headers
# 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
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. @param id [String] The ID of the system in question. @param [Hash] opts the optional parameters @return [Array<System>]
# 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
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. @param id [String] The ID of the system in question. @param [Hash] opts the optional parameters @return [Array<(Array<System>, Integer, Hash)>] Array<System> data, response status code and response headers
# 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
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. @param id [String] The ID of the system in question. @param [Hash] opts the optional parameters @option opts [Time] :before 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. @return [Array<Switch>]
# 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
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. @param id [String] The ID of the system in question. @param [Hash] opts the optional parameters @option opts [Time] :before 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. @return [Array<(Array<Switch>, Integer, Hash)>] Array<Switch> data, response status code and response headers
# 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
Gets a system by its ID. Partial information may be returned if not authenticated with this system's token. @param id [String] The ID of the system in question. @param [Hash] opts the optional parameters @return [Array<(System
, Integer, Hash)>] System
data, response status code and response headers
# 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
Updates an existing system. Requires authentication, and will update the system the token belongs to. @param system [System] @param [Hash] opts the optional parameters @return [System]
# 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
Updates an existing system. Requires authentication, and will update the system the token belongs to. @param system [System] @param [Hash] opts the optional parameters @return [Array<(System
, Integer, Hash)>] System
data, response status code and response headers
# 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