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.
- checksums.yaml +7 -0
- data/Gemfile +9 -0
- data/README.md +136 -0
- data/Rakefile +10 -0
- data/docs/AccountsApi.md +72 -0
- data/docs/FullSwitch.md +20 -0
- data/docs/Member.md +58 -0
- data/docs/MembersApi.md +353 -0
- data/docs/Message.md +30 -0
- data/docs/PrivacySetting.md +15 -0
- data/docs/ProxyTag.md +20 -0
- data/docs/ProxyingApi.md +70 -0
- data/docs/Switch.md +20 -0
- data/docs/SwitchesApi.md +208 -0
- data/docs/System.md +40 -0
- data/docs/SystemsApi.md +475 -0
- data/git_push.sh +58 -0
- data/lib/pluralkit-api.rb +51 -0
- data/lib/pluralkit-api/api/accounts_api.rb +98 -0
- data/lib/pluralkit-api/api/members_api.rb +389 -0
- data/lib/pluralkit-api/api/proxying_api.rb +96 -0
- data/lib/pluralkit-api/api/switches_api.rb +236 -0
- data/lib/pluralkit-api/api/systems_api.rb +525 -0
- data/lib/pluralkit-api/api_client.rb +390 -0
- data/lib/pluralkit-api/api_error.rb +57 -0
- data/lib/pluralkit-api/configuration.rb +277 -0
- data/lib/pluralkit-api/models/full_switch.rb +231 -0
- data/lib/pluralkit-api/models/member.rb +568 -0
- data/lib/pluralkit-api/models/message.rb +274 -0
- data/lib/pluralkit-api/models/privacy_setting.rb +37 -0
- data/lib/pluralkit-api/models/proxy_tag.rb +262 -0
- data/lib/pluralkit-api/models/switch.rb +231 -0
- data/lib/pluralkit-api/models/system.rb +417 -0
- data/lib/pluralkit-api/version.rb +15 -0
- data/pluralkit-api.gemspec +38 -0
- data/spec/api/accounts_api_spec.rb +47 -0
- data/spec/api/members_api_spec.rb +92 -0
- data/spec/api/proxying_api_spec.rb +46 -0
- data/spec/api/switches_api_spec.rb +70 -0
- data/spec/api/systems_api_spec.rb +118 -0
- data/spec/api_client_spec.rb +226 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/full_switch_spec.rb +40 -0
- data/spec/models/member_spec.rb +154 -0
- data/spec/models/message_spec.rb +70 -0
- data/spec/models/privacy_setting_spec.rb +28 -0
- data/spec/models/proxy_tag_spec.rb +40 -0
- data/spec/models/switch_spec.rb +40 -0
- data/spec/models/system_spec.rb +94 -0
- data/spec/spec_helper.rb +111 -0
- metadata +147 -0
data/git_push.sh
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
|
3
|
+
#
|
4
|
+
# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" "gitlab.com"
|
5
|
+
|
6
|
+
git_user_id=$1
|
7
|
+
git_repo_id=$2
|
8
|
+
release_note=$3
|
9
|
+
git_host=$4
|
10
|
+
|
11
|
+
if [ "$git_host" = "" ]; then
|
12
|
+
git_host=""
|
13
|
+
echo "[INFO] No command line input provided. Set \$git_host to $git_host"
|
14
|
+
fi
|
15
|
+
|
16
|
+
if [ "$git_user_id" = "" ]; then
|
17
|
+
git_user_id=""
|
18
|
+
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
|
19
|
+
fi
|
20
|
+
|
21
|
+
if [ "$git_repo_id" = "" ]; then
|
22
|
+
git_repo_id=""
|
23
|
+
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
|
24
|
+
fi
|
25
|
+
|
26
|
+
if [ "$release_note" = "" ]; then
|
27
|
+
release_note=""
|
28
|
+
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
|
29
|
+
fi
|
30
|
+
|
31
|
+
# Initialize the local directory as a Git repository
|
32
|
+
git init
|
33
|
+
|
34
|
+
# Adds the files in the local repository and stages them for commit.
|
35
|
+
git add .
|
36
|
+
|
37
|
+
# Commits the tracked changes and prepares them to be pushed to a remote repository.
|
38
|
+
git commit -m "$release_note"
|
39
|
+
|
40
|
+
# Sets the new remote
|
41
|
+
git_remote=`git remote`
|
42
|
+
if [ "$git_remote" = "" ]; then # git remote not defined
|
43
|
+
|
44
|
+
if [ "$GIT_TOKEN" = "" ]; then
|
45
|
+
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
|
46
|
+
git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
|
47
|
+
else
|
48
|
+
git remote add origin https://${git_user_id}:${GIT_TOKEN}@${git_host}/${git_user_id}/${git_repo_id}.git
|
49
|
+
fi
|
50
|
+
|
51
|
+
fi
|
52
|
+
|
53
|
+
git pull origin master
|
54
|
+
|
55
|
+
# Pushes (Forces) the changes in the local repository up to the remote repository
|
56
|
+
echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
|
57
|
+
git push origin master 2>&1 | grep -v 'To https'
|
58
|
+
|
@@ -0,0 +1,51 @@
|
|
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
|
+
# Common files
|
14
|
+
require 'pluralkit-api/api_client'
|
15
|
+
require 'pluralkit-api/api_error'
|
16
|
+
require 'pluralkit-api/version'
|
17
|
+
require 'pluralkit-api/configuration'
|
18
|
+
|
19
|
+
# Models
|
20
|
+
require 'pluralkit-api/models/full_switch'
|
21
|
+
require 'pluralkit-api/models/member'
|
22
|
+
require 'pluralkit-api/models/message'
|
23
|
+
require 'pluralkit-api/models/privacy_setting'
|
24
|
+
require 'pluralkit-api/models/proxy_tag'
|
25
|
+
require 'pluralkit-api/models/switch'
|
26
|
+
require 'pluralkit-api/models/system'
|
27
|
+
|
28
|
+
# APIs
|
29
|
+
require 'pluralkit-api/api/accounts_api'
|
30
|
+
require 'pluralkit-api/api/members_api'
|
31
|
+
require 'pluralkit-api/api/proxying_api'
|
32
|
+
require 'pluralkit-api/api/switches_api'
|
33
|
+
require 'pluralkit-api/api/systems_api'
|
34
|
+
|
35
|
+
module PluralKitAPI
|
36
|
+
class << self
|
37
|
+
# Customize default settings for the SDK using block.
|
38
|
+
# PluralKitAPI.configure do |config|
|
39
|
+
# config.username = "xxx"
|
40
|
+
# config.password = "xxx"
|
41
|
+
# end
|
42
|
+
# If no block given, return the default Configuration object.
|
43
|
+
def configure
|
44
|
+
if block_given?
|
45
|
+
yield(Configuration.default)
|
46
|
+
else
|
47
|
+
Configuration.default
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,98 @@
|
|
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 AccountsApi
|
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's currently not possible to get a system's registered accounts given a system ID through the API. Consider this endpoint \"one-way\".
|
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: AccountsApi.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 AccountsApi.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 AccountsApi.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 AccountsApi.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 AccountsApi.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 => :"AccountsApi.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: AccountsApi#a_id_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
94
|
+
end
|
95
|
+
return data, status_code, headers
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
@@ -0,0 +1,389 @@
|
|
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 MembersApi
|
17
|
+
attr_accessor :api_client
|
18
|
+
|
19
|
+
def initialize(api_client = ApiClient.default)
|
20
|
+
@api_client = api_client
|
21
|
+
end
|
22
|
+
# Creates a new member in your system.
|
23
|
+
# @param member [Member]
|
24
|
+
# @param [Hash] opts the optional parameters
|
25
|
+
# @return [Member]
|
26
|
+
def create_member(member, opts = {})
|
27
|
+
data, _status_code, _headers = create_member_with_http_info(member, opts)
|
28
|
+
data
|
29
|
+
end
|
30
|
+
|
31
|
+
# Creates a new member in your system.
|
32
|
+
# @param member [Member]
|
33
|
+
# @param [Hash] opts the optional parameters
|
34
|
+
# @return [Array<(Member, Integer, Hash)>] Member data, response status code and response headers
|
35
|
+
def create_member_with_http_info(member, opts = {})
|
36
|
+
if @api_client.config.debugging
|
37
|
+
@api_client.config.logger.debug 'Calling API: MembersApi.create_member ...'
|
38
|
+
end
|
39
|
+
# verify the required parameter 'member' is set
|
40
|
+
if @api_client.config.client_side_validation && member.nil?
|
41
|
+
fail ArgumentError, "Missing the required parameter 'member' when calling MembersApi.create_member"
|
42
|
+
end
|
43
|
+
# resource path
|
44
|
+
local_var_path = '/m'
|
45
|
+
|
46
|
+
# query parameters
|
47
|
+
query_params = opts[:query_params] || {}
|
48
|
+
|
49
|
+
# header parameters
|
50
|
+
header_params = opts[:header_params] || {}
|
51
|
+
# HTTP header 'Accept' (if needed)
|
52
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
53
|
+
# HTTP header 'Content-Type'
|
54
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
55
|
+
|
56
|
+
# form parameters
|
57
|
+
form_params = opts[:form_params] || {}
|
58
|
+
|
59
|
+
# http body (model)
|
60
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(member)
|
61
|
+
|
62
|
+
# return_type
|
63
|
+
return_type = opts[:debug_return_type] || 'Member'
|
64
|
+
|
65
|
+
# auth_names
|
66
|
+
auth_names = opts[:debug_auth_names] || ['TokenAuth']
|
67
|
+
|
68
|
+
new_options = opts.merge(
|
69
|
+
:operation => :"MembersApi.create_member",
|
70
|
+
:header_params => header_params,
|
71
|
+
:query_params => query_params,
|
72
|
+
:form_params => form_params,
|
73
|
+
:body => post_body,
|
74
|
+
:auth_names => auth_names,
|
75
|
+
:return_type => return_type
|
76
|
+
)
|
77
|
+
|
78
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
79
|
+
if @api_client.config.debugging
|
80
|
+
@api_client.config.logger.debug "API called: MembersApi#create_member\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
81
|
+
end
|
82
|
+
return data, status_code, headers
|
83
|
+
end
|
84
|
+
|
85
|
+
# Deletes a member.
|
86
|
+
# @param id [String] The ID of the member in question.
|
87
|
+
# @param [Hash] opts the optional parameters
|
88
|
+
# @return [nil]
|
89
|
+
def delete_member(id, opts = {})
|
90
|
+
delete_member_with_http_info(id, opts)
|
91
|
+
nil
|
92
|
+
end
|
93
|
+
|
94
|
+
# Deletes a member.
|
95
|
+
# @param id [String] The ID of the member in question.
|
96
|
+
# @param [Hash] opts the optional parameters
|
97
|
+
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
|
98
|
+
def delete_member_with_http_info(id, opts = {})
|
99
|
+
if @api_client.config.debugging
|
100
|
+
@api_client.config.logger.debug 'Calling API: MembersApi.delete_member ...'
|
101
|
+
end
|
102
|
+
# verify the required parameter 'id' is set
|
103
|
+
if @api_client.config.client_side_validation && id.nil?
|
104
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling MembersApi.delete_member"
|
105
|
+
end
|
106
|
+
if @api_client.config.client_side_validation && id.to_s.length > 5
|
107
|
+
fail ArgumentError, 'invalid value for "id" when calling MembersApi.delete_member, the character length must be smaller than or equal to 5.'
|
108
|
+
end
|
109
|
+
|
110
|
+
if @api_client.config.client_side_validation && id.to_s.length < 5
|
111
|
+
fail ArgumentError, 'invalid value for "id" when calling MembersApi.delete_member, the character length must be great than or equal to 5.'
|
112
|
+
end
|
113
|
+
|
114
|
+
pattern = Regexp.new(/^[a-z]{5}$/)
|
115
|
+
if @api_client.config.client_side_validation && id !~ pattern
|
116
|
+
fail ArgumentError, "invalid value for 'id' when calling MembersApi.delete_member, must conform to the pattern #{pattern}."
|
117
|
+
end
|
118
|
+
|
119
|
+
# resource path
|
120
|
+
local_var_path = '/m/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
|
121
|
+
|
122
|
+
# query parameters
|
123
|
+
query_params = opts[:query_params] || {}
|
124
|
+
|
125
|
+
# header parameters
|
126
|
+
header_params = opts[:header_params] || {}
|
127
|
+
|
128
|
+
# form parameters
|
129
|
+
form_params = opts[:form_params] || {}
|
130
|
+
|
131
|
+
# http body (model)
|
132
|
+
post_body = opts[:debug_body]
|
133
|
+
|
134
|
+
# return_type
|
135
|
+
return_type = opts[:debug_return_type]
|
136
|
+
|
137
|
+
# auth_names
|
138
|
+
auth_names = opts[:debug_auth_names] || ['TokenAuth']
|
139
|
+
|
140
|
+
new_options = opts.merge(
|
141
|
+
:operation => :"MembersApi.delete_member",
|
142
|
+
:header_params => header_params,
|
143
|
+
:query_params => query_params,
|
144
|
+
:form_params => form_params,
|
145
|
+
:body => post_body,
|
146
|
+
:auth_names => auth_names,
|
147
|
+
:return_type => return_type
|
148
|
+
)
|
149
|
+
|
150
|
+
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
|
151
|
+
if @api_client.config.debugging
|
152
|
+
@api_client.config.logger.debug "API called: MembersApi#delete_member\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
153
|
+
end
|
154
|
+
return data, status_code, headers
|
155
|
+
end
|
156
|
+
|
157
|
+
# Gets a member by their ID.
|
158
|
+
# @param id [String] The ID of the member in question.
|
159
|
+
# @param [Hash] opts the optional parameters
|
160
|
+
# @return [Member]
|
161
|
+
def get_member(id, opts = {})
|
162
|
+
data, _status_code, _headers = get_member_with_http_info(id, opts)
|
163
|
+
data
|
164
|
+
end
|
165
|
+
|
166
|
+
# Gets a member by their ID.
|
167
|
+
# @param id [String] The ID of the member in question.
|
168
|
+
# @param [Hash] opts the optional parameters
|
169
|
+
# @return [Array<(Member, Integer, Hash)>] Member data, response status code and response headers
|
170
|
+
def get_member_with_http_info(id, opts = {})
|
171
|
+
if @api_client.config.debugging
|
172
|
+
@api_client.config.logger.debug 'Calling API: MembersApi.get_member ...'
|
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 MembersApi.get_member"
|
177
|
+
end
|
178
|
+
if @api_client.config.client_side_validation && id.to_s.length > 5
|
179
|
+
fail ArgumentError, 'invalid value for "id" when calling MembersApi.get_member, 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 MembersApi.get_member, 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 MembersApi.get_member, must conform to the pattern #{pattern}."
|
189
|
+
end
|
190
|
+
|
191
|
+
# resource path
|
192
|
+
local_var_path = '/m/{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] || 'Member'
|
210
|
+
|
211
|
+
# auth_names
|
212
|
+
auth_names = opts[:debug_auth_names] || ['TokenAuth']
|
213
|
+
|
214
|
+
new_options = opts.merge(
|
215
|
+
:operation => :"MembersApi.get_member",
|
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: MembersApi#get_member\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 members.
|
232
|
+
# If the API token does not belong to this system, this list may exclude any private members in the system.
|
233
|
+
# @param id [String] The ID of the system in question.
|
234
|
+
# @param [Hash] opts the optional parameters
|
235
|
+
# @return [Array<System>]
|
236
|
+
def get_system_members(id, opts = {})
|
237
|
+
data, _status_code, _headers = get_system_members_with_http_info(id, opts)
|
238
|
+
data
|
239
|
+
end
|
240
|
+
|
241
|
+
# Gets a system's members.
|
242
|
+
# If the API token does not belong to this system, this list may exclude any private members in the system.
|
243
|
+
# @param id [String] The ID of the system in question.
|
244
|
+
# @param [Hash] opts the optional parameters
|
245
|
+
# @return [Array<(Array<System>, Integer, Hash)>] Array<System> data, response status code and response headers
|
246
|
+
def get_system_members_with_http_info(id, opts = {})
|
247
|
+
if @api_client.config.debugging
|
248
|
+
@api_client.config.logger.debug 'Calling API: MembersApi.get_system_members ...'
|
249
|
+
end
|
250
|
+
# verify the required parameter 'id' is set
|
251
|
+
if @api_client.config.client_side_validation && id.nil?
|
252
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling MembersApi.get_system_members"
|
253
|
+
end
|
254
|
+
if @api_client.config.client_side_validation && id.to_s.length > 5
|
255
|
+
fail ArgumentError, 'invalid value for "id" when calling MembersApi.get_system_members, the character length must be smaller than or equal to 5.'
|
256
|
+
end
|
257
|
+
|
258
|
+
if @api_client.config.client_side_validation && id.to_s.length < 5
|
259
|
+
fail ArgumentError, 'invalid value for "id" when calling MembersApi.get_system_members, the character length must be great than or equal to 5.'
|
260
|
+
end
|
261
|
+
|
262
|
+
pattern = Regexp.new(/^[a-z]{5}$/)
|
263
|
+
if @api_client.config.client_side_validation && id !~ pattern
|
264
|
+
fail ArgumentError, "invalid value for 'id' when calling MembersApi.get_system_members, must conform to the pattern #{pattern}."
|
265
|
+
end
|
266
|
+
|
267
|
+
# resource path
|
268
|
+
local_var_path = '/s/{id}/members'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
|
269
|
+
|
270
|
+
# query parameters
|
271
|
+
query_params = opts[:query_params] || {}
|
272
|
+
|
273
|
+
# header parameters
|
274
|
+
header_params = opts[:header_params] || {}
|
275
|
+
# HTTP header 'Accept' (if needed)
|
276
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
277
|
+
|
278
|
+
# form parameters
|
279
|
+
form_params = opts[:form_params] || {}
|
280
|
+
|
281
|
+
# http body (model)
|
282
|
+
post_body = opts[:debug_body]
|
283
|
+
|
284
|
+
# return_type
|
285
|
+
return_type = opts[:debug_return_type] || 'Array<System>'
|
286
|
+
|
287
|
+
# auth_names
|
288
|
+
auth_names = opts[:debug_auth_names] || []
|
289
|
+
|
290
|
+
new_options = opts.merge(
|
291
|
+
:operation => :"MembersApi.get_system_members",
|
292
|
+
:header_params => header_params,
|
293
|
+
:query_params => query_params,
|
294
|
+
:form_params => form_params,
|
295
|
+
:body => post_body,
|
296
|
+
:auth_names => auth_names,
|
297
|
+
:return_type => return_type
|
298
|
+
)
|
299
|
+
|
300
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
301
|
+
if @api_client.config.debugging
|
302
|
+
@api_client.config.logger.debug "API called: MembersApi#get_system_members\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
303
|
+
end
|
304
|
+
return data, status_code, headers
|
305
|
+
end
|
306
|
+
|
307
|
+
# Updates a member.
|
308
|
+
# @param id [String] The ID of the member in question.
|
309
|
+
# @param member [Member]
|
310
|
+
# @param [Hash] opts the optional parameters
|
311
|
+
# @return [Member]
|
312
|
+
def update_member(id, member, opts = {})
|
313
|
+
data, _status_code, _headers = update_member_with_http_info(id, member, opts)
|
314
|
+
data
|
315
|
+
end
|
316
|
+
|
317
|
+
# Updates a member.
|
318
|
+
# @param id [String] The ID of the member in question.
|
319
|
+
# @param member [Member]
|
320
|
+
# @param [Hash] opts the optional parameters
|
321
|
+
# @return [Array<(Member, Integer, Hash)>] Member data, response status code and response headers
|
322
|
+
def update_member_with_http_info(id, member, opts = {})
|
323
|
+
if @api_client.config.debugging
|
324
|
+
@api_client.config.logger.debug 'Calling API: MembersApi.update_member ...'
|
325
|
+
end
|
326
|
+
# verify the required parameter 'id' is set
|
327
|
+
if @api_client.config.client_side_validation && id.nil?
|
328
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling MembersApi.update_member"
|
329
|
+
end
|
330
|
+
if @api_client.config.client_side_validation && id.to_s.length > 5
|
331
|
+
fail ArgumentError, 'invalid value for "id" when calling MembersApi.update_member, the character length must be smaller than or equal to 5.'
|
332
|
+
end
|
333
|
+
|
334
|
+
if @api_client.config.client_side_validation && id.to_s.length < 5
|
335
|
+
fail ArgumentError, 'invalid value for "id" when calling MembersApi.update_member, the character length must be great than or equal to 5.'
|
336
|
+
end
|
337
|
+
|
338
|
+
pattern = Regexp.new(/^[a-z]{5}$/)
|
339
|
+
if @api_client.config.client_side_validation && id !~ pattern
|
340
|
+
fail ArgumentError, "invalid value for 'id' when calling MembersApi.update_member, must conform to the pattern #{pattern}."
|
341
|
+
end
|
342
|
+
|
343
|
+
# verify the required parameter 'member' is set
|
344
|
+
if @api_client.config.client_side_validation && member.nil?
|
345
|
+
fail ArgumentError, "Missing the required parameter 'member' when calling MembersApi.update_member"
|
346
|
+
end
|
347
|
+
# resource path
|
348
|
+
local_var_path = '/m/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
|
349
|
+
|
350
|
+
# query parameters
|
351
|
+
query_params = opts[:query_params] || {}
|
352
|
+
|
353
|
+
# header parameters
|
354
|
+
header_params = opts[:header_params] || {}
|
355
|
+
# HTTP header 'Accept' (if needed)
|
356
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
357
|
+
# HTTP header 'Content-Type'
|
358
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
359
|
+
|
360
|
+
# form parameters
|
361
|
+
form_params = opts[:form_params] || {}
|
362
|
+
|
363
|
+
# http body (model)
|
364
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(member)
|
365
|
+
|
366
|
+
# return_type
|
367
|
+
return_type = opts[:debug_return_type] || 'Member'
|
368
|
+
|
369
|
+
# auth_names
|
370
|
+
auth_names = opts[:debug_auth_names] || ['TokenAuth']
|
371
|
+
|
372
|
+
new_options = opts.merge(
|
373
|
+
:operation => :"MembersApi.update_member",
|
374
|
+
:header_params => header_params,
|
375
|
+
:query_params => query_params,
|
376
|
+
:form_params => form_params,
|
377
|
+
:body => post_body,
|
378
|
+
:auth_names => auth_names,
|
379
|
+
:return_type => return_type
|
380
|
+
)
|
381
|
+
|
382
|
+
data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
|
383
|
+
if @api_client.config.debugging
|
384
|
+
@api_client.config.logger.debug "API called: MembersApi#update_member\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
385
|
+
end
|
386
|
+
return data, status_code, headers
|
387
|
+
end
|
388
|
+
end
|
389
|
+
end
|