pluralkit-api 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/README.md +136 -0
  4. data/Rakefile +10 -0
  5. data/docs/AccountsApi.md +72 -0
  6. data/docs/FullSwitch.md +20 -0
  7. data/docs/Member.md +58 -0
  8. data/docs/MembersApi.md +353 -0
  9. data/docs/Message.md +30 -0
  10. data/docs/PrivacySetting.md +15 -0
  11. data/docs/ProxyTag.md +20 -0
  12. data/docs/ProxyingApi.md +70 -0
  13. data/docs/Switch.md +20 -0
  14. data/docs/SwitchesApi.md +208 -0
  15. data/docs/System.md +40 -0
  16. data/docs/SystemsApi.md +475 -0
  17. data/git_push.sh +58 -0
  18. data/lib/pluralkit-api.rb +51 -0
  19. data/lib/pluralkit-api/api/accounts_api.rb +98 -0
  20. data/lib/pluralkit-api/api/members_api.rb +389 -0
  21. data/lib/pluralkit-api/api/proxying_api.rb +96 -0
  22. data/lib/pluralkit-api/api/switches_api.rb +236 -0
  23. data/lib/pluralkit-api/api/systems_api.rb +525 -0
  24. data/lib/pluralkit-api/api_client.rb +390 -0
  25. data/lib/pluralkit-api/api_error.rb +57 -0
  26. data/lib/pluralkit-api/configuration.rb +277 -0
  27. data/lib/pluralkit-api/models/full_switch.rb +231 -0
  28. data/lib/pluralkit-api/models/member.rb +568 -0
  29. data/lib/pluralkit-api/models/message.rb +274 -0
  30. data/lib/pluralkit-api/models/privacy_setting.rb +37 -0
  31. data/lib/pluralkit-api/models/proxy_tag.rb +262 -0
  32. data/lib/pluralkit-api/models/switch.rb +231 -0
  33. data/lib/pluralkit-api/models/system.rb +417 -0
  34. data/lib/pluralkit-api/version.rb +15 -0
  35. data/pluralkit-api.gemspec +38 -0
  36. data/spec/api/accounts_api_spec.rb +47 -0
  37. data/spec/api/members_api_spec.rb +92 -0
  38. data/spec/api/proxying_api_spec.rb +46 -0
  39. data/spec/api/switches_api_spec.rb +70 -0
  40. data/spec/api/systems_api_spec.rb +118 -0
  41. data/spec/api_client_spec.rb +226 -0
  42. data/spec/configuration_spec.rb +42 -0
  43. data/spec/models/full_switch_spec.rb +40 -0
  44. data/spec/models/member_spec.rb +154 -0
  45. data/spec/models/message_spec.rb +70 -0
  46. data/spec/models/privacy_setting_spec.rb +28 -0
  47. data/spec/models/proxy_tag_spec.rb +40 -0
  48. data/spec/models/switch_spec.rb +40 -0
  49. data/spec/models/system_spec.rb +94 -0
  50. data/spec/spec_helper.rb +111 -0
  51. metadata +147 -0
@@ -0,0 +1,96 @@
1
+ =begin
2
+ #PluralKit
3
+
4
+ #This is the API for [PluralKit](https://pluralkit.me/)! :) The API itself is stable, but this document (the OpenAPI description) is still subject to change, and may be updated, corrected or restructured in the future (as long as it's still coherent with the real API). # Authentication Authentication is handled using a \"system token\". At the moment, the only way to obtain a system token is to use the `pk;token` command through the Discord bot. This will generate an opaque string you must pass as the `Authorization` header to API requests. Many API endpoints are available anonymously, but most of them will hide information from unauthenticated requests to align with the relevant privacy settings. # Errors Errors are just returned as HTTP response codes. Most error responses include a human-readable error message as the body, but this should not be relied on. Just read the response codes :) # OpenAPI version history - **1.1**: Granular member privacy - **1.0**: (initial definition version)
5
+
6
+ The version of the OpenAPI document: 1.1
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.2.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module PluralKitAPI
16
+ class ProxyingApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Gets information about a proxied message by its message ID.
23
+ # @param id [String] A Discord message ID. This may refer to either the original \"trigger message\" posted by the user, or to the resulting webhook message posted by PluralKit. The former may be useful for eg. logging bot integration.
24
+ # @param [Hash] opts the optional parameters
25
+ # @return [Message]
26
+ def msg_id_get(id, opts = {})
27
+ data, _status_code, _headers = msg_id_get_with_http_info(id, opts)
28
+ data
29
+ end
30
+
31
+ # Gets information about a proxied message by its message ID.
32
+ # @param id [String] A Discord message ID. This may refer to either the original \"trigger message\" posted by the user, or to the resulting webhook message posted by PluralKit. The former may be useful for eg. logging bot integration.
33
+ # @param [Hash] opts the optional parameters
34
+ # @return [Array<(Message, Integer, Hash)>] Message data, response status code and response headers
35
+ def msg_id_get_with_http_info(id, opts = {})
36
+ if @api_client.config.debugging
37
+ @api_client.config.logger.debug 'Calling API: ProxyingApi.msg_id_get ...'
38
+ end
39
+ # verify the required parameter 'id' is set
40
+ if @api_client.config.client_side_validation && id.nil?
41
+ fail ArgumentError, "Missing the required parameter 'id' when calling ProxyingApi.msg_id_get"
42
+ end
43
+ if @api_client.config.client_side_validation && id.to_s.length > 19
44
+ fail ArgumentError, 'invalid value for "id" when calling ProxyingApi.msg_id_get, the character length must be smaller than or equal to 19.'
45
+ end
46
+
47
+ if @api_client.config.client_side_validation && id.to_s.length < 17
48
+ fail ArgumentError, 'invalid value for "id" when calling ProxyingApi.msg_id_get, the character length must be great than or equal to 17.'
49
+ end
50
+
51
+ pattern = Regexp.new(/^[0-9]{17,19}/)
52
+ if @api_client.config.client_side_validation && id !~ pattern
53
+ fail ArgumentError, "invalid value for 'id' when calling ProxyingApi.msg_id_get, must conform to the pattern #{pattern}."
54
+ end
55
+
56
+ # resource path
57
+ local_var_path = '/msg/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
58
+
59
+ # query parameters
60
+ query_params = opts[:query_params] || {}
61
+
62
+ # header parameters
63
+ header_params = opts[:header_params] || {}
64
+ # HTTP header 'Accept' (if needed)
65
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
66
+
67
+ # form parameters
68
+ form_params = opts[:form_params] || {}
69
+
70
+ # http body (model)
71
+ post_body = opts[:debug_body]
72
+
73
+ # return_type
74
+ return_type = opts[:debug_return_type] || 'Message'
75
+
76
+ # auth_names
77
+ auth_names = opts[:debug_auth_names] || []
78
+
79
+ new_options = opts.merge(
80
+ :operation => :"ProxyingApi.msg_id_get",
81
+ :header_params => header_params,
82
+ :query_params => query_params,
83
+ :form_params => form_params,
84
+ :body => post_body,
85
+ :auth_names => auth_names,
86
+ :return_type => return_type
87
+ )
88
+
89
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
90
+ if @api_client.config.debugging
91
+ @api_client.config.logger.debug "API called: ProxyingApi#msg_id_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
92
+ end
93
+ return data, status_code, headers
94
+ end
95
+ end
96
+ end
@@ -0,0 +1,236 @@
1
+ =begin
2
+ #PluralKit
3
+
4
+ #This is the API for [PluralKit](https://pluralkit.me/)! :) The API itself is stable, but this document (the OpenAPI description) is still subject to change, and may be updated, corrected or restructured in the future (as long as it's still coherent with the real API). # Authentication Authentication is handled using a \"system token\". At the moment, the only way to obtain a system token is to use the `pk;token` command through the Discord bot. This will generate an opaque string you must pass as the `Authorization` header to API requests. Many API endpoints are available anonymously, but most of them will hide information from unauthenticated requests to align with the relevant privacy settings. # Errors Errors are just returned as HTTP response codes. Most error responses include a human-readable error message as the body, but this should not be relied on. Just read the response codes :) # OpenAPI version history - **1.1**: Granular member privacy - **1.0**: (initial definition version)
5
+
6
+ The version of the OpenAPI document: 1.1
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.2.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module PluralKitAPI
16
+ class SwitchesApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Gets a system's current fronters.
23
+ # @param id [String] The ID of the system in question.
24
+ # @param [Hash] opts the optional parameters
25
+ # @return [FullSwitch]
26
+ def get_system_fronters(id, opts = {})
27
+ data, _status_code, _headers = get_system_fronters_with_http_info(id, opts)
28
+ data
29
+ end
30
+
31
+ # Gets a system&#39;s current fronters.
32
+ # @param id [String] The ID of the system in question.
33
+ # @param [Hash] opts the optional parameters
34
+ # @return [Array<(FullSwitch, Integer, Hash)>] FullSwitch data, response status code and response headers
35
+ def get_system_fronters_with_http_info(id, opts = {})
36
+ if @api_client.config.debugging
37
+ @api_client.config.logger.debug 'Calling API: SwitchesApi.get_system_fronters ...'
38
+ end
39
+ # verify the required parameter 'id' is set
40
+ if @api_client.config.client_side_validation && id.nil?
41
+ fail ArgumentError, "Missing the required parameter 'id' when calling SwitchesApi.get_system_fronters"
42
+ end
43
+ if @api_client.config.client_side_validation && id.to_s.length > 5
44
+ fail ArgumentError, 'invalid value for "id" when calling SwitchesApi.get_system_fronters, the character length must be smaller than or equal to 5.'
45
+ end
46
+
47
+ if @api_client.config.client_side_validation && id.to_s.length < 5
48
+ fail ArgumentError, 'invalid value for "id" when calling SwitchesApi.get_system_fronters, the character length must be great than or equal to 5.'
49
+ end
50
+
51
+ pattern = Regexp.new(/^[a-z]{5}$/)
52
+ if @api_client.config.client_side_validation && id !~ pattern
53
+ fail ArgumentError, "invalid value for 'id' when calling SwitchesApi.get_system_fronters, must conform to the pattern #{pattern}."
54
+ end
55
+
56
+ # resource path
57
+ local_var_path = '/s/{id}/fronters'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
58
+
59
+ # query parameters
60
+ query_params = opts[:query_params] || {}
61
+
62
+ # header parameters
63
+ header_params = opts[:header_params] || {}
64
+ # HTTP header 'Accept' (if needed)
65
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
66
+
67
+ # form parameters
68
+ form_params = opts[:form_params] || {}
69
+
70
+ # http body (model)
71
+ post_body = opts[:debug_body]
72
+
73
+ # return_type
74
+ return_type = opts[:debug_return_type] || 'FullSwitch'
75
+
76
+ # auth_names
77
+ auth_names = opts[:debug_auth_names] || []
78
+
79
+ new_options = opts.merge(
80
+ :operation => :"SwitchesApi.get_system_fronters",
81
+ :header_params => header_params,
82
+ :query_params => query_params,
83
+ :form_params => form_params,
84
+ :body => post_body,
85
+ :auth_names => auth_names,
86
+ :return_type => return_type
87
+ )
88
+
89
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
90
+ if @api_client.config.debugging
91
+ @api_client.config.logger.debug "API called: SwitchesApi#get_system_fronters\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
92
+ end
93
+ return data, status_code, headers
94
+ end
95
+
96
+ # Gets a system's switch history.
97
+ # 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.
98
+ # @param id [String] The ID of the system in question.
99
+ # @param [Hash] opts the optional parameters
100
+ # @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.
101
+ # @return [Array<Switch>]
102
+ def get_system_switches(id, opts = {})
103
+ data, _status_code, _headers = get_system_switches_with_http_info(id, opts)
104
+ data
105
+ end
106
+
107
+ # Gets a system&#39;s switch history.
108
+ # 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.
109
+ # @param id [String] The ID of the system in question.
110
+ # @param [Hash] opts the optional parameters
111
+ # @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.
112
+ # @return [Array<(Array<Switch>, Integer, Hash)>] Array<Switch> data, response status code and response headers
113
+ def get_system_switches_with_http_info(id, opts = {})
114
+ if @api_client.config.debugging
115
+ @api_client.config.logger.debug 'Calling API: SwitchesApi.get_system_switches ...'
116
+ end
117
+ # verify the required parameter 'id' is set
118
+ if @api_client.config.client_side_validation && id.nil?
119
+ fail ArgumentError, "Missing the required parameter 'id' when calling SwitchesApi.get_system_switches"
120
+ end
121
+ if @api_client.config.client_side_validation && id.to_s.length > 5
122
+ fail ArgumentError, 'invalid value for "id" when calling SwitchesApi.get_system_switches, the character length must be smaller than or equal to 5.'
123
+ end
124
+
125
+ if @api_client.config.client_side_validation && id.to_s.length < 5
126
+ fail ArgumentError, 'invalid value for "id" when calling SwitchesApi.get_system_switches, the character length must be great than or equal to 5.'
127
+ end
128
+
129
+ pattern = Regexp.new(/^[a-z]{5}$/)
130
+ if @api_client.config.client_side_validation && id !~ pattern
131
+ fail ArgumentError, "invalid value for 'id' when calling SwitchesApi.get_system_switches, must conform to the pattern #{pattern}."
132
+ end
133
+
134
+ # resource path
135
+ local_var_path = '/s/{id}/switches'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
136
+
137
+ # query parameters
138
+ query_params = opts[:query_params] || {}
139
+ query_params[:'before'] = opts[:'before'] if !opts[:'before'].nil?
140
+
141
+ # header parameters
142
+ header_params = opts[:header_params] || {}
143
+ # HTTP header 'Accept' (if needed)
144
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
145
+
146
+ # form parameters
147
+ form_params = opts[:form_params] || {}
148
+
149
+ # http body (model)
150
+ post_body = opts[:debug_body]
151
+
152
+ # return_type
153
+ return_type = opts[:debug_return_type] || 'Array<Switch>'
154
+
155
+ # auth_names
156
+ auth_names = opts[:debug_auth_names] || []
157
+
158
+ new_options = opts.merge(
159
+ :operation => :"SwitchesApi.get_system_switches",
160
+ :header_params => header_params,
161
+ :query_params => query_params,
162
+ :form_params => form_params,
163
+ :body => post_body,
164
+ :auth_names => auth_names,
165
+ :return_type => return_type
166
+ )
167
+
168
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
169
+ if @api_client.config.debugging
170
+ @api_client.config.logger.debug "API called: SwitchesApi#get_system_switches\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
171
+ end
172
+ return data, status_code, headers
173
+ end
174
+
175
+ # Registers a new switch.
176
+ # @param switch [Switch]
177
+ # @param [Hash] opts the optional parameters
178
+ # @return [nil]
179
+ def register_switch(switch, opts = {})
180
+ register_switch_with_http_info(switch, opts)
181
+ nil
182
+ end
183
+
184
+ # Registers a new switch.
185
+ # @param switch [Switch]
186
+ # @param [Hash] opts the optional parameters
187
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
188
+ def register_switch_with_http_info(switch, opts = {})
189
+ if @api_client.config.debugging
190
+ @api_client.config.logger.debug 'Calling API: SwitchesApi.register_switch ...'
191
+ end
192
+ # verify the required parameter 'switch' is set
193
+ if @api_client.config.client_side_validation && switch.nil?
194
+ fail ArgumentError, "Missing the required parameter 'switch' when calling SwitchesApi.register_switch"
195
+ end
196
+ # resource path
197
+ local_var_path = '/s/switches'
198
+
199
+ # query parameters
200
+ query_params = opts[:query_params] || {}
201
+
202
+ # header parameters
203
+ header_params = opts[:header_params] || {}
204
+ # HTTP header 'Content-Type'
205
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
206
+
207
+ # form parameters
208
+ form_params = opts[:form_params] || {}
209
+
210
+ # http body (model)
211
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(switch)
212
+
213
+ # return_type
214
+ return_type = opts[:debug_return_type]
215
+
216
+ # auth_names
217
+ auth_names = opts[:debug_auth_names] || ['TokenAuth']
218
+
219
+ new_options = opts.merge(
220
+ :operation => :"SwitchesApi.register_switch",
221
+ :header_params => header_params,
222
+ :query_params => query_params,
223
+ :form_params => form_params,
224
+ :body => post_body,
225
+ :auth_names => auth_names,
226
+ :return_type => return_type
227
+ )
228
+
229
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
230
+ if @api_client.config.debugging
231
+ @api_client.config.logger.debug "API called: SwitchesApi#register_switch\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
232
+ end
233
+ return data, status_code, headers
234
+ end
235
+ end
236
+ end
@@ -0,0 +1,525 @@
1
+ =begin
2
+ #PluralKit
3
+
4
+ #This is the API for [PluralKit](https://pluralkit.me/)! :) The API itself is stable, but this document (the OpenAPI description) is still subject to change, and may be updated, corrected or restructured in the future (as long as it's still coherent with the real API). # Authentication Authentication is handled using a \"system token\". At the moment, the only way to obtain a system token is to use the `pk;token` command through the Discord bot. This will generate an opaque string you must pass as the `Authorization` header to API requests. Many API endpoints are available anonymously, but most of them will hide information from unauthenticated requests to align with the relevant privacy settings. # Errors Errors are just returned as HTTP response codes. Most error responses include a human-readable error message as the body, but this should not be relied on. Just read the response codes :) # OpenAPI version history - **1.1**: Granular member privacy - **1.0**: (initial definition version)
5
+
6
+ The version of the OpenAPI document: 1.1
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.2.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module PluralKitAPI
16
+ class SystemsApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Gets a system by (one of) its associated Discord accounts.
23
+ # 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\".
24
+ # @param id [String] A Discord user ID.
25
+ # @param [Hash] opts the optional parameters
26
+ # @return [System]
27
+ def a_id_get(id, opts = {})
28
+ data, _status_code, _headers = a_id_get_with_http_info(id, opts)
29
+ data
30
+ end
31
+
32
+ # Gets a system by (one of) its associated Discord accounts.
33
+ # 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;.
34
+ # @param id [String] A Discord user ID.
35
+ # @param [Hash] opts the optional parameters
36
+ # @return [Array<(System, Integer, Hash)>] System data, response status code and response headers
37
+ def a_id_get_with_http_info(id, opts = {})
38
+ if @api_client.config.debugging
39
+ @api_client.config.logger.debug 'Calling API: SystemsApi.a_id_get ...'
40
+ end
41
+ # verify the required parameter 'id' is set
42
+ if @api_client.config.client_side_validation && id.nil?
43
+ fail ArgumentError, "Missing the required parameter 'id' when calling SystemsApi.a_id_get"
44
+ end
45
+ if @api_client.config.client_side_validation && id.to_s.length > 19
46
+ fail ArgumentError, 'invalid value for "id" when calling SystemsApi.a_id_get, the character length must be smaller than or equal to 19.'
47
+ end
48
+
49
+ if @api_client.config.client_side_validation && id.to_s.length < 17
50
+ fail ArgumentError, 'invalid value for "id" when calling SystemsApi.a_id_get, the character length must be great than or equal to 17.'
51
+ end
52
+
53
+ pattern = Regexp.new(/^[0-9]{17,19}/)
54
+ if @api_client.config.client_side_validation && id !~ pattern
55
+ fail ArgumentError, "invalid value for 'id' when calling SystemsApi.a_id_get, must conform to the pattern #{pattern}."
56
+ end
57
+
58
+ # resource path
59
+ local_var_path = '/a/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
60
+
61
+ # query parameters
62
+ query_params = opts[:query_params] || {}
63
+
64
+ # header parameters
65
+ header_params = opts[:header_params] || {}
66
+ # HTTP header 'Accept' (if needed)
67
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
68
+
69
+ # form parameters
70
+ form_params = opts[:form_params] || {}
71
+
72
+ # http body (model)
73
+ post_body = opts[:debug_body]
74
+
75
+ # return_type
76
+ return_type = opts[:debug_return_type] || 'System'
77
+
78
+ # auth_names
79
+ auth_names = opts[:debug_auth_names] || []
80
+
81
+ new_options = opts.merge(
82
+ :operation => :"SystemsApi.a_id_get",
83
+ :header_params => header_params,
84
+ :query_params => query_params,
85
+ :form_params => form_params,
86
+ :body => post_body,
87
+ :auth_names => auth_names,
88
+ :return_type => return_type
89
+ )
90
+
91
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
92
+ if @api_client.config.debugging
93
+ @api_client.config.logger.debug "API called: SystemsApi#a_id_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
94
+ end
95
+ return data, status_code, headers
96
+ end
97
+
98
+ # Returns your own system.
99
+ # Requires authentication, and will returns the system the token belongs to.
100
+ # @param [Hash] opts the optional parameters
101
+ # @return [System]
102
+ def get_own_system(opts = {})
103
+ data, _status_code, _headers = get_own_system_with_http_info(opts)
104
+ data
105
+ end
106
+
107
+ # Returns your own system.
108
+ # Requires authentication, and will returns the system the token belongs to.
109
+ # @param [Hash] opts the optional parameters
110
+ # @return [Array<(System, Integer, Hash)>] System data, response status code and response headers
111
+ def get_own_system_with_http_info(opts = {})
112
+ if @api_client.config.debugging
113
+ @api_client.config.logger.debug 'Calling API: SystemsApi.get_own_system ...'
114
+ end
115
+ # resource path
116
+ local_var_path = '/s'
117
+
118
+ # query parameters
119
+ query_params = opts[:query_params] || {}
120
+
121
+ # header parameters
122
+ header_params = opts[:header_params] || {}
123
+ # HTTP header 'Accept' (if needed)
124
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
125
+
126
+ # form parameters
127
+ form_params = opts[:form_params] || {}
128
+
129
+ # http body (model)
130
+ post_body = opts[:debug_body]
131
+
132
+ # return_type
133
+ return_type = opts[:debug_return_type] || 'System'
134
+
135
+ # auth_names
136
+ auth_names = opts[:debug_auth_names] || ['TokenAuth']
137
+
138
+ new_options = opts.merge(
139
+ :operation => :"SystemsApi.get_own_system",
140
+ :header_params => header_params,
141
+ :query_params => query_params,
142
+ :form_params => form_params,
143
+ :body => post_body,
144
+ :auth_names => auth_names,
145
+ :return_type => return_type
146
+ )
147
+
148
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
149
+ if @api_client.config.debugging
150
+ @api_client.config.logger.debug "API called: SystemsApi#get_own_system\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
151
+ end
152
+ return data, status_code, headers
153
+ end
154
+
155
+ # Gets a system by its ID.
156
+ # Partial information may be returned if not authenticated with this system's token.
157
+ # @param id [String] The ID of the system in question.
158
+ # @param [Hash] opts the optional parameters
159
+ # @return [System]
160
+ def get_system(id, opts = {})
161
+ data, _status_code, _headers = get_system_with_http_info(id, opts)
162
+ data
163
+ end
164
+
165
+ # Gets a system by its ID.
166
+ # Partial information may be returned if not authenticated with this system&#39;s token.
167
+ # @param id [String] The ID of the system in question.
168
+ # @param [Hash] opts the optional parameters
169
+ # @return [Array<(System, Integer, Hash)>] System data, response status code and response headers
170
+ def get_system_with_http_info(id, opts = {})
171
+ if @api_client.config.debugging
172
+ @api_client.config.logger.debug 'Calling API: SystemsApi.get_system ...'
173
+ end
174
+ # verify the required parameter 'id' is set
175
+ if @api_client.config.client_side_validation && id.nil?
176
+ fail ArgumentError, "Missing the required parameter 'id' when calling SystemsApi.get_system"
177
+ end
178
+ if @api_client.config.client_side_validation && id.to_s.length > 5
179
+ fail ArgumentError, 'invalid value for "id" when calling SystemsApi.get_system, the character length must be smaller than or equal to 5.'
180
+ end
181
+
182
+ if @api_client.config.client_side_validation && id.to_s.length < 5
183
+ fail ArgumentError, 'invalid value for "id" when calling SystemsApi.get_system, the character length must be great than or equal to 5.'
184
+ end
185
+
186
+ pattern = Regexp.new(/^[a-z]{5}$/)
187
+ if @api_client.config.client_side_validation && id !~ pattern
188
+ fail ArgumentError, "invalid value for 'id' when calling SystemsApi.get_system, must conform to the pattern #{pattern}."
189
+ end
190
+
191
+ # resource path
192
+ local_var_path = '/s/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
193
+
194
+ # query parameters
195
+ query_params = opts[:query_params] || {}
196
+
197
+ # header parameters
198
+ header_params = opts[:header_params] || {}
199
+ # HTTP header 'Accept' (if needed)
200
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
201
+
202
+ # form parameters
203
+ form_params = opts[:form_params] || {}
204
+
205
+ # http body (model)
206
+ post_body = opts[:debug_body]
207
+
208
+ # return_type
209
+ return_type = opts[:debug_return_type] || 'System'
210
+
211
+ # auth_names
212
+ auth_names = opts[:debug_auth_names] || []
213
+
214
+ new_options = opts.merge(
215
+ :operation => :"SystemsApi.get_system",
216
+ :header_params => header_params,
217
+ :query_params => query_params,
218
+ :form_params => form_params,
219
+ :body => post_body,
220
+ :auth_names => auth_names,
221
+ :return_type => return_type
222
+ )
223
+
224
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
225
+ if @api_client.config.debugging
226
+ @api_client.config.logger.debug "API called: SystemsApi#get_system\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
227
+ end
228
+ return data, status_code, headers
229
+ end
230
+
231
+ # Gets a system's current fronters.
232
+ # @param id [String] The ID of the system in question.
233
+ # @param [Hash] opts the optional parameters
234
+ # @return [FullSwitch]
235
+ def get_system_fronters(id, opts = {})
236
+ data, _status_code, _headers = get_system_fronters_with_http_info(id, opts)
237
+ data
238
+ end
239
+
240
+ # Gets a system&#39;s current fronters.
241
+ # @param id [String] The ID of the system in question.
242
+ # @param [Hash] opts the optional parameters
243
+ # @return [Array<(FullSwitch, Integer, Hash)>] FullSwitch data, response status code and response headers
244
+ def get_system_fronters_with_http_info(id, opts = {})
245
+ if @api_client.config.debugging
246
+ @api_client.config.logger.debug 'Calling API: SystemsApi.get_system_fronters ...'
247
+ end
248
+ # verify the required parameter 'id' is set
249
+ if @api_client.config.client_side_validation && id.nil?
250
+ fail ArgumentError, "Missing the required parameter 'id' when calling SystemsApi.get_system_fronters"
251
+ end
252
+ if @api_client.config.client_side_validation && id.to_s.length > 5
253
+ fail ArgumentError, 'invalid value for "id" when calling SystemsApi.get_system_fronters, the character length must be smaller than or equal to 5.'
254
+ end
255
+
256
+ if @api_client.config.client_side_validation && id.to_s.length < 5
257
+ fail ArgumentError, 'invalid value for "id" when calling SystemsApi.get_system_fronters, the character length must be great than or equal to 5.'
258
+ end
259
+
260
+ pattern = Regexp.new(/^[a-z]{5}$/)
261
+ if @api_client.config.client_side_validation && id !~ pattern
262
+ fail ArgumentError, "invalid value for 'id' when calling SystemsApi.get_system_fronters, must conform to the pattern #{pattern}."
263
+ end
264
+
265
+ # resource path
266
+ local_var_path = '/s/{id}/fronters'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
267
+
268
+ # query parameters
269
+ query_params = opts[:query_params] || {}
270
+
271
+ # header parameters
272
+ header_params = opts[:header_params] || {}
273
+ # HTTP header 'Accept' (if needed)
274
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
275
+
276
+ # form parameters
277
+ form_params = opts[:form_params] || {}
278
+
279
+ # http body (model)
280
+ post_body = opts[:debug_body]
281
+
282
+ # return_type
283
+ return_type = opts[:debug_return_type] || 'FullSwitch'
284
+
285
+ # auth_names
286
+ auth_names = opts[:debug_auth_names] || []
287
+
288
+ new_options = opts.merge(
289
+ :operation => :"SystemsApi.get_system_fronters",
290
+ :header_params => header_params,
291
+ :query_params => query_params,
292
+ :form_params => form_params,
293
+ :body => post_body,
294
+ :auth_names => auth_names,
295
+ :return_type => return_type
296
+ )
297
+
298
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
299
+ if @api_client.config.debugging
300
+ @api_client.config.logger.debug "API called: SystemsApi#get_system_fronters\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
301
+ end
302
+ return data, status_code, headers
303
+ end
304
+
305
+ # Gets a system's members.
306
+ # If the API token does not belong to this system, this list may exclude any private members in the system.
307
+ # @param id [String] The ID of the system in question.
308
+ # @param [Hash] opts the optional parameters
309
+ # @return [Array<System>]
310
+ def get_system_members(id, opts = {})
311
+ data, _status_code, _headers = get_system_members_with_http_info(id, opts)
312
+ data
313
+ end
314
+
315
+ # Gets a system&#39;s members.
316
+ # If the API token does not belong to this system, this list may exclude any private members in the system.
317
+ # @param id [String] The ID of the system in question.
318
+ # @param [Hash] opts the optional parameters
319
+ # @return [Array<(Array<System>, Integer, Hash)>] Array<System> data, response status code and response headers
320
+ def get_system_members_with_http_info(id, opts = {})
321
+ if @api_client.config.debugging
322
+ @api_client.config.logger.debug 'Calling API: SystemsApi.get_system_members ...'
323
+ end
324
+ # verify the required parameter 'id' is set
325
+ if @api_client.config.client_side_validation && id.nil?
326
+ fail ArgumentError, "Missing the required parameter 'id' when calling SystemsApi.get_system_members"
327
+ end
328
+ if @api_client.config.client_side_validation && id.to_s.length > 5
329
+ fail ArgumentError, 'invalid value for "id" when calling SystemsApi.get_system_members, the character length must be smaller than or equal to 5.'
330
+ end
331
+
332
+ if @api_client.config.client_side_validation && id.to_s.length < 5
333
+ fail ArgumentError, 'invalid value for "id" when calling SystemsApi.get_system_members, the character length must be great than or equal to 5.'
334
+ end
335
+
336
+ pattern = Regexp.new(/^[a-z]{5}$/)
337
+ if @api_client.config.client_side_validation && id !~ pattern
338
+ fail ArgumentError, "invalid value for 'id' when calling SystemsApi.get_system_members, must conform to the pattern #{pattern}."
339
+ end
340
+
341
+ # resource path
342
+ local_var_path = '/s/{id}/members'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
343
+
344
+ # query parameters
345
+ query_params = opts[:query_params] || {}
346
+
347
+ # header parameters
348
+ header_params = opts[:header_params] || {}
349
+ # HTTP header 'Accept' (if needed)
350
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
351
+
352
+ # form parameters
353
+ form_params = opts[:form_params] || {}
354
+
355
+ # http body (model)
356
+ post_body = opts[:debug_body]
357
+
358
+ # return_type
359
+ return_type = opts[:debug_return_type] || 'Array<System>'
360
+
361
+ # auth_names
362
+ auth_names = opts[:debug_auth_names] || []
363
+
364
+ new_options = opts.merge(
365
+ :operation => :"SystemsApi.get_system_members",
366
+ :header_params => header_params,
367
+ :query_params => query_params,
368
+ :form_params => form_params,
369
+ :body => post_body,
370
+ :auth_names => auth_names,
371
+ :return_type => return_type
372
+ )
373
+
374
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
375
+ if @api_client.config.debugging
376
+ @api_client.config.logger.debug "API called: SystemsApi#get_system_members\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
377
+ end
378
+ return data, status_code, headers
379
+ end
380
+
381
+ # Gets a system's switch history.
382
+ # 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.
383
+ # @param id [String] The ID of the system in question.
384
+ # @param [Hash] opts the optional parameters
385
+ # @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.
386
+ # @return [Array<Switch>]
387
+ def get_system_switches(id, opts = {})
388
+ data, _status_code, _headers = get_system_switches_with_http_info(id, opts)
389
+ data
390
+ end
391
+
392
+ # Gets a system&#39;s switch history.
393
+ # 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.
394
+ # @param id [String] The ID of the system in question.
395
+ # @param [Hash] opts the optional parameters
396
+ # @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.
397
+ # @return [Array<(Array<Switch>, Integer, Hash)>] Array<Switch> data, response status code and response headers
398
+ def get_system_switches_with_http_info(id, opts = {})
399
+ if @api_client.config.debugging
400
+ @api_client.config.logger.debug 'Calling API: SystemsApi.get_system_switches ...'
401
+ end
402
+ # verify the required parameter 'id' is set
403
+ if @api_client.config.client_side_validation && id.nil?
404
+ fail ArgumentError, "Missing the required parameter 'id' when calling SystemsApi.get_system_switches"
405
+ end
406
+ if @api_client.config.client_side_validation && id.to_s.length > 5
407
+ fail ArgumentError, 'invalid value for "id" when calling SystemsApi.get_system_switches, the character length must be smaller than or equal to 5.'
408
+ end
409
+
410
+ if @api_client.config.client_side_validation && id.to_s.length < 5
411
+ fail ArgumentError, 'invalid value for "id" when calling SystemsApi.get_system_switches, the character length must be great than or equal to 5.'
412
+ end
413
+
414
+ pattern = Regexp.new(/^[a-z]{5}$/)
415
+ if @api_client.config.client_side_validation && id !~ pattern
416
+ fail ArgumentError, "invalid value for 'id' when calling SystemsApi.get_system_switches, must conform to the pattern #{pattern}."
417
+ end
418
+
419
+ # resource path
420
+ local_var_path = '/s/{id}/switches'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
421
+
422
+ # query parameters
423
+ query_params = opts[:query_params] || {}
424
+ query_params[:'before'] = opts[:'before'] if !opts[:'before'].nil?
425
+
426
+ # header parameters
427
+ header_params = opts[:header_params] || {}
428
+ # HTTP header 'Accept' (if needed)
429
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
430
+
431
+ # form parameters
432
+ form_params = opts[:form_params] || {}
433
+
434
+ # http body (model)
435
+ post_body = opts[:debug_body]
436
+
437
+ # return_type
438
+ return_type = opts[:debug_return_type] || 'Array<Switch>'
439
+
440
+ # auth_names
441
+ auth_names = opts[:debug_auth_names] || []
442
+
443
+ new_options = opts.merge(
444
+ :operation => :"SystemsApi.get_system_switches",
445
+ :header_params => header_params,
446
+ :query_params => query_params,
447
+ :form_params => form_params,
448
+ :body => post_body,
449
+ :auth_names => auth_names,
450
+ :return_type => return_type
451
+ )
452
+
453
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
454
+ if @api_client.config.debugging
455
+ @api_client.config.logger.debug "API called: SystemsApi#get_system_switches\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
456
+ end
457
+ return data, status_code, headers
458
+ end
459
+
460
+ # Updates an existing system.
461
+ # Requires authentication, and will update the system the token belongs to.
462
+ # @param system [System]
463
+ # @param [Hash] opts the optional parameters
464
+ # @return [System]
465
+ def update_system(system, opts = {})
466
+ data, _status_code, _headers = update_system_with_http_info(system, opts)
467
+ data
468
+ end
469
+
470
+ # Updates an existing system.
471
+ # Requires authentication, and will update the system the token belongs to.
472
+ # @param system [System]
473
+ # @param [Hash] opts the optional parameters
474
+ # @return [Array<(System, Integer, Hash)>] System data, response status code and response headers
475
+ def update_system_with_http_info(system, opts = {})
476
+ if @api_client.config.debugging
477
+ @api_client.config.logger.debug 'Calling API: SystemsApi.update_system ...'
478
+ end
479
+ # verify the required parameter 'system' is set
480
+ if @api_client.config.client_side_validation && system.nil?
481
+ fail ArgumentError, "Missing the required parameter 'system' when calling SystemsApi.update_system"
482
+ end
483
+ # resource path
484
+ local_var_path = '/s'
485
+
486
+ # query parameters
487
+ query_params = opts[:query_params] || {}
488
+
489
+ # header parameters
490
+ header_params = opts[:header_params] || {}
491
+ # HTTP header 'Accept' (if needed)
492
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
493
+ # HTTP header 'Content-Type'
494
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
495
+
496
+ # form parameters
497
+ form_params = opts[:form_params] || {}
498
+
499
+ # http body (model)
500
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(system)
501
+
502
+ # return_type
503
+ return_type = opts[:debug_return_type] || 'System'
504
+
505
+ # auth_names
506
+ auth_names = opts[:debug_auth_names] || ['TokenAuth']
507
+
508
+ new_options = opts.merge(
509
+ :operation => :"SystemsApi.update_system",
510
+ :header_params => header_params,
511
+ :query_params => query_params,
512
+ :form_params => form_params,
513
+ :body => post_body,
514
+ :auth_names => auth_names,
515
+ :return_type => return_type
516
+ )
517
+
518
+ data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
519
+ if @api_client.config.debugging
520
+ @api_client.config.logger.debug "API called: SystemsApi#update_system\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
521
+ end
522
+ return data, status_code, headers
523
+ end
524
+ end
525
+ end