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
@@ -0,0 +1,15 @@
|
|
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
|
+
module PluralKitAPI
|
14
|
+
VERSION = '1.0.0'
|
15
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
=begin
|
4
|
+
#PluralKit
|
5
|
+
|
6
|
+
#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)
|
7
|
+
|
8
|
+
The version of the OpenAPI document: 1.1
|
9
|
+
|
10
|
+
Generated by: https://openapi-generator.tech
|
11
|
+
OpenAPI Generator version: 5.2.0-SNAPSHOT
|
12
|
+
|
13
|
+
=end
|
14
|
+
|
15
|
+
$:.push File.expand_path("../lib", __FILE__)
|
16
|
+
require "pluralkit-api/version"
|
17
|
+
|
18
|
+
Gem::Specification.new do |s|
|
19
|
+
s.name = "pluralkit-api"
|
20
|
+
s.version = PluralKitAPI::VERSION
|
21
|
+
s.platform = Gem::Platform::RUBY
|
22
|
+
s.authors = ["Anna Kudriavtsev"]
|
23
|
+
s.email = ["anna328p@gmail.com"]
|
24
|
+
s.homepage = "https://github.com/anna328p/ruby-pluralkit-api"
|
25
|
+
s.summary = "API client for PluralKit"
|
26
|
+
s.description = "A client for the PluralKit REST API"
|
27
|
+
s.license = "AGPL-3.0-or-later"
|
28
|
+
s.required_ruby_version = ">= 2.4"
|
29
|
+
|
30
|
+
s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1'
|
31
|
+
|
32
|
+
s.add_development_dependency 'rspec', '~> 3.6', '>= 3.6.0'
|
33
|
+
|
34
|
+
s.files = `find *`.split("\n").uniq.sort.select { |f| !f.empty? }
|
35
|
+
s.test_files = `find spec/*`.split("\n")
|
36
|
+
s.executables = []
|
37
|
+
s.require_paths = ["lib"]
|
38
|
+
end
|
@@ -0,0 +1,47 @@
|
|
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 'spec_helper'
|
14
|
+
require 'json'
|
15
|
+
|
16
|
+
# Unit tests for PluralKitAPI::AccountsApi
|
17
|
+
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
18
|
+
# Please update as you see appropriate
|
19
|
+
describe 'AccountsApi' do
|
20
|
+
before do
|
21
|
+
# run before each test
|
22
|
+
@api_instance = PluralKitAPI::AccountsApi.new
|
23
|
+
end
|
24
|
+
|
25
|
+
after do
|
26
|
+
# run after each test
|
27
|
+
end
|
28
|
+
|
29
|
+
describe 'test an instance of AccountsApi' do
|
30
|
+
it 'should create an instance of AccountsApi' do
|
31
|
+
expect(@api_instance).to be_instance_of(PluralKitAPI::AccountsApi)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# unit tests for a_id_get
|
36
|
+
# Gets a system by (one of) its associated Discord accounts.
|
37
|
+
# 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\".
|
38
|
+
# @param id A Discord user ID.
|
39
|
+
# @param [Hash] opts the optional parameters
|
40
|
+
# @return [System]
|
41
|
+
describe 'a_id_get test' do
|
42
|
+
it 'should work' do
|
43
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
@@ -0,0 +1,92 @@
|
|
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 'spec_helper'
|
14
|
+
require 'json'
|
15
|
+
|
16
|
+
# Unit tests for PluralKitAPI::MembersApi
|
17
|
+
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
18
|
+
# Please update as you see appropriate
|
19
|
+
describe 'MembersApi' do
|
20
|
+
before do
|
21
|
+
# run before each test
|
22
|
+
@api_instance = PluralKitAPI::MembersApi.new
|
23
|
+
end
|
24
|
+
|
25
|
+
after do
|
26
|
+
# run after each test
|
27
|
+
end
|
28
|
+
|
29
|
+
describe 'test an instance of MembersApi' do
|
30
|
+
it 'should create an instance of MembersApi' do
|
31
|
+
expect(@api_instance).to be_instance_of(PluralKitAPI::MembersApi)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# unit tests for create_member
|
36
|
+
# Creates a new member in your system.
|
37
|
+
# @param member
|
38
|
+
# @param [Hash] opts the optional parameters
|
39
|
+
# @return [Member]
|
40
|
+
describe 'create_member test' do
|
41
|
+
it 'should work' do
|
42
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
# unit tests for delete_member
|
47
|
+
# Deletes a member.
|
48
|
+
# @param id The ID of the member in question.
|
49
|
+
# @param [Hash] opts the optional parameters
|
50
|
+
# @return [nil]
|
51
|
+
describe 'delete_member test' do
|
52
|
+
it 'should work' do
|
53
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
# unit tests for get_member
|
58
|
+
# Gets a member by their ID.
|
59
|
+
# @param id The ID of the member in question.
|
60
|
+
# @param [Hash] opts the optional parameters
|
61
|
+
# @return [Member]
|
62
|
+
describe 'get_member test' do
|
63
|
+
it 'should work' do
|
64
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
# unit tests for get_system_members
|
69
|
+
# Gets a system's members.
|
70
|
+
# If the API token does not belong to this system, this list may exclude any private members in the system.
|
71
|
+
# @param id The ID of the system in question.
|
72
|
+
# @param [Hash] opts the optional parameters
|
73
|
+
# @return [Array<System>]
|
74
|
+
describe 'get_system_members test' do
|
75
|
+
it 'should work' do
|
76
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
# unit tests for update_member
|
81
|
+
# Updates a member.
|
82
|
+
# @param id The ID of the member in question.
|
83
|
+
# @param member
|
84
|
+
# @param [Hash] opts the optional parameters
|
85
|
+
# @return [Member]
|
86
|
+
describe 'update_member test' do
|
87
|
+
it 'should work' do
|
88
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
end
|
@@ -0,0 +1,46 @@
|
|
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 'spec_helper'
|
14
|
+
require 'json'
|
15
|
+
|
16
|
+
# Unit tests for PluralKitAPI::ProxyingApi
|
17
|
+
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
18
|
+
# Please update as you see appropriate
|
19
|
+
describe 'ProxyingApi' do
|
20
|
+
before do
|
21
|
+
# run before each test
|
22
|
+
@api_instance = PluralKitAPI::ProxyingApi.new
|
23
|
+
end
|
24
|
+
|
25
|
+
after do
|
26
|
+
# run after each test
|
27
|
+
end
|
28
|
+
|
29
|
+
describe 'test an instance of ProxyingApi' do
|
30
|
+
it 'should create an instance of ProxyingApi' do
|
31
|
+
expect(@api_instance).to be_instance_of(PluralKitAPI::ProxyingApi)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# unit tests for msg_id_get
|
36
|
+
# Gets information about a proxied message by its message ID.
|
37
|
+
# @param id 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.
|
38
|
+
# @param [Hash] opts the optional parameters
|
39
|
+
# @return [Message]
|
40
|
+
describe 'msg_id_get test' do
|
41
|
+
it 'should work' do
|
42
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
@@ -0,0 +1,70 @@
|
|
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 'spec_helper'
|
14
|
+
require 'json'
|
15
|
+
|
16
|
+
# Unit tests for PluralKitAPI::SwitchesApi
|
17
|
+
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
18
|
+
# Please update as you see appropriate
|
19
|
+
describe 'SwitchesApi' do
|
20
|
+
before do
|
21
|
+
# run before each test
|
22
|
+
@api_instance = PluralKitAPI::SwitchesApi.new
|
23
|
+
end
|
24
|
+
|
25
|
+
after do
|
26
|
+
# run after each test
|
27
|
+
end
|
28
|
+
|
29
|
+
describe 'test an instance of SwitchesApi' do
|
30
|
+
it 'should create an instance of SwitchesApi' do
|
31
|
+
expect(@api_instance).to be_instance_of(PluralKitAPI::SwitchesApi)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# unit tests for get_system_fronters
|
36
|
+
# Gets a system's current fronters.
|
37
|
+
# @param id The ID of the system in question.
|
38
|
+
# @param [Hash] opts the optional parameters
|
39
|
+
# @return [FullSwitch]
|
40
|
+
describe 'get_system_fronters test' do
|
41
|
+
it 'should work' do
|
42
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
# unit tests for get_system_switches
|
47
|
+
# Gets a system's switch history.
|
48
|
+
# 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.
|
49
|
+
# @param id The ID of the system in question.
|
50
|
+
# @param [Hash] opts the optional parameters
|
51
|
+
# @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.
|
52
|
+
# @return [Array<Switch>]
|
53
|
+
describe 'get_system_switches test' do
|
54
|
+
it 'should work' do
|
55
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
# unit tests for register_switch
|
60
|
+
# Registers a new switch.
|
61
|
+
# @param switch
|
62
|
+
# @param [Hash] opts the optional parameters
|
63
|
+
# @return [nil]
|
64
|
+
describe 'register_switch test' do
|
65
|
+
it 'should work' do
|
66
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
@@ -0,0 +1,118 @@
|
|
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 'spec_helper'
|
14
|
+
require 'json'
|
15
|
+
|
16
|
+
# Unit tests for PluralKitAPI::SystemsApi
|
17
|
+
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
18
|
+
# Please update as you see appropriate
|
19
|
+
describe 'SystemsApi' do
|
20
|
+
before do
|
21
|
+
# run before each test
|
22
|
+
@api_instance = PluralKitAPI::SystemsApi.new
|
23
|
+
end
|
24
|
+
|
25
|
+
after do
|
26
|
+
# run after each test
|
27
|
+
end
|
28
|
+
|
29
|
+
describe 'test an instance of SystemsApi' do
|
30
|
+
it 'should create an instance of SystemsApi' do
|
31
|
+
expect(@api_instance).to be_instance_of(PluralKitAPI::SystemsApi)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# unit tests for a_id_get
|
36
|
+
# Gets a system by (one of) its associated Discord accounts.
|
37
|
+
# 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\".
|
38
|
+
# @param id A Discord user ID.
|
39
|
+
# @param [Hash] opts the optional parameters
|
40
|
+
# @return [System]
|
41
|
+
describe 'a_id_get test' do
|
42
|
+
it 'should work' do
|
43
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
# unit tests for get_own_system
|
48
|
+
# Returns your own system.
|
49
|
+
# Requires authentication, and will returns the system the token belongs to.
|
50
|
+
# @param [Hash] opts the optional parameters
|
51
|
+
# @return [System]
|
52
|
+
describe 'get_own_system test' do
|
53
|
+
it 'should work' do
|
54
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
# unit tests for get_system
|
59
|
+
# Gets a system by its ID.
|
60
|
+
# Partial information may be returned if not authenticated with this system's token.
|
61
|
+
# @param id The ID of the system in question.
|
62
|
+
# @param [Hash] opts the optional parameters
|
63
|
+
# @return [System]
|
64
|
+
describe 'get_system test' do
|
65
|
+
it 'should work' do
|
66
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
# unit tests for get_system_fronters
|
71
|
+
# Gets a system's current fronters.
|
72
|
+
# @param id The ID of the system in question.
|
73
|
+
# @param [Hash] opts the optional parameters
|
74
|
+
# @return [FullSwitch]
|
75
|
+
describe 'get_system_fronters test' do
|
76
|
+
it 'should work' do
|
77
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
# unit tests for get_system_members
|
82
|
+
# Gets a system's members.
|
83
|
+
# If the API token does not belong to this system, this list may exclude any private members in the system.
|
84
|
+
# @param id The ID of the system in question.
|
85
|
+
# @param [Hash] opts the optional parameters
|
86
|
+
# @return [Array<System>]
|
87
|
+
describe 'get_system_members test' do
|
88
|
+
it 'should work' do
|
89
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
# unit tests for get_system_switches
|
94
|
+
# Gets a system's switch history.
|
95
|
+
# 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.
|
96
|
+
# @param id The ID of the system in question.
|
97
|
+
# @param [Hash] opts the optional parameters
|
98
|
+
# @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.
|
99
|
+
# @return [Array<Switch>]
|
100
|
+
describe 'get_system_switches test' do
|
101
|
+
it 'should work' do
|
102
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
# unit tests for update_system
|
107
|
+
# Updates an existing system.
|
108
|
+
# Requires authentication, and will update the system the token belongs to.
|
109
|
+
# @param system
|
110
|
+
# @param [Hash] opts the optional parameters
|
111
|
+
# @return [System]
|
112
|
+
describe 'update_system test' do
|
113
|
+
it 'should work' do
|
114
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
end
|
@@ -0,0 +1,226 @@
|
|
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 'spec_helper'
|
14
|
+
|
15
|
+
describe PluralKitAPI::ApiClient do
|
16
|
+
context 'initialization' do
|
17
|
+
context 'URL stuff' do
|
18
|
+
context 'host' do
|
19
|
+
it 'removes http from host' do
|
20
|
+
PluralKitAPI.configure { |c| c.host = 'http://example.com' }
|
21
|
+
expect(PluralKitAPI::Configuration.default.host).to eq('example.com')
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'removes https from host' do
|
25
|
+
PluralKitAPI.configure { |c| c.host = 'https://wookiee.com' }
|
26
|
+
expect(PluralKitAPI::ApiClient.default.config.host).to eq('wookiee.com')
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'removes trailing path from host' do
|
30
|
+
PluralKitAPI.configure { |c| c.host = 'hobo.com/v4' }
|
31
|
+
expect(PluralKitAPI::Configuration.default.host).to eq('hobo.com')
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
context 'base_path' do
|
36
|
+
it "prepends a slash to base_path" do
|
37
|
+
PluralKitAPI.configure { |c| c.base_path = 'v4/dog' }
|
38
|
+
expect(PluralKitAPI::Configuration.default.base_path).to eq('/v4/dog')
|
39
|
+
end
|
40
|
+
|
41
|
+
it "doesn't prepend a slash if one is already there" do
|
42
|
+
PluralKitAPI.configure { |c| c.base_path = '/v4/dog' }
|
43
|
+
expect(PluralKitAPI::Configuration.default.base_path).to eq('/v4/dog')
|
44
|
+
end
|
45
|
+
|
46
|
+
it "ends up as a blank string if nil" do
|
47
|
+
PluralKitAPI.configure { |c| c.base_path = nil }
|
48
|
+
expect(PluralKitAPI::Configuration.default.base_path).to eq('')
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
describe 'params_encoding in #build_request' do
|
55
|
+
let(:config) { PluralKitAPI::Configuration.new }
|
56
|
+
let(:api_client) { PluralKitAPI::ApiClient.new(config) }
|
57
|
+
|
58
|
+
it 'defaults to nil' do
|
59
|
+
expect(PluralKitAPI::Configuration.default.params_encoding).to eq(nil)
|
60
|
+
expect(config.params_encoding).to eq(nil)
|
61
|
+
|
62
|
+
request = api_client.build_request(:get, '/test')
|
63
|
+
expect(request.options[:params_encoding]).to eq(nil)
|
64
|
+
end
|
65
|
+
|
66
|
+
it 'can be customized' do
|
67
|
+
config.params_encoding = :multi
|
68
|
+
request = api_client.build_request(:get, '/test')
|
69
|
+
expect(request.options[:params_encoding]).to eq(:multi)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
describe 'timeout in #build_request' do
|
74
|
+
let(:config) { PluralKitAPI::Configuration.new }
|
75
|
+
let(:api_client) { PluralKitAPI::ApiClient.new(config) }
|
76
|
+
|
77
|
+
it 'defaults to 0' do
|
78
|
+
expect(PluralKitAPI::Configuration.default.timeout).to eq(0)
|
79
|
+
expect(config.timeout).to eq(0)
|
80
|
+
|
81
|
+
request = api_client.build_request(:get, '/test')
|
82
|
+
expect(request.options[:timeout]).to eq(0)
|
83
|
+
end
|
84
|
+
|
85
|
+
it 'can be customized' do
|
86
|
+
config.timeout = 100
|
87
|
+
request = api_client.build_request(:get, '/test')
|
88
|
+
expect(request.options[:timeout]).to eq(100)
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
describe '#deserialize' do
|
93
|
+
it "handles Array<Integer>" do
|
94
|
+
api_client = PluralKitAPI::ApiClient.new
|
95
|
+
headers = { 'Content-Type' => 'application/json' }
|
96
|
+
response = double('response', headers: headers, body: '[12, 34]')
|
97
|
+
data = api_client.deserialize(response, 'Array<Integer>')
|
98
|
+
expect(data).to be_instance_of(Array)
|
99
|
+
expect(data).to eq([12, 34])
|
100
|
+
end
|
101
|
+
|
102
|
+
it 'handles Array<Array<Integer>>' do
|
103
|
+
api_client = PluralKitAPI::ApiClient.new
|
104
|
+
headers = { 'Content-Type' => 'application/json' }
|
105
|
+
response = double('response', headers: headers, body: '[[12, 34], [56]]')
|
106
|
+
data = api_client.deserialize(response, 'Array<Array<Integer>>')
|
107
|
+
expect(data).to be_instance_of(Array)
|
108
|
+
expect(data).to eq([[12, 34], [56]])
|
109
|
+
end
|
110
|
+
|
111
|
+
it 'handles Hash<String, String>' do
|
112
|
+
api_client = PluralKitAPI::ApiClient.new
|
113
|
+
headers = { 'Content-Type' => 'application/json' }
|
114
|
+
response = double('response', headers: headers, body: '{"message": "Hello"}')
|
115
|
+
data = api_client.deserialize(response, 'Hash<String, String>')
|
116
|
+
expect(data).to be_instance_of(Hash)
|
117
|
+
expect(data).to eq(:message => 'Hello')
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
describe "#object_to_hash" do
|
122
|
+
it 'ignores nils and includes empty arrays' do
|
123
|
+
# uncomment below to test object_to_hash for model
|
124
|
+
# api_client = PluralKitAPI::ApiClient.new
|
125
|
+
# _model = PluralKitAPI::ModelName.new
|
126
|
+
# update the model attribute below
|
127
|
+
# _model.id = 1
|
128
|
+
# update the expected value (hash) below
|
129
|
+
# expected = {id: 1, name: '', tags: []}
|
130
|
+
# expect(api_client.object_to_hash(_model)).to eq(expected)
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
describe '#build_collection_param' do
|
135
|
+
let(:param) { ['aa', 'bb', 'cc'] }
|
136
|
+
let(:api_client) { PluralKitAPI::ApiClient.new }
|
137
|
+
|
138
|
+
it 'works for csv' do
|
139
|
+
expect(api_client.build_collection_param(param, :csv)).to eq('aa,bb,cc')
|
140
|
+
end
|
141
|
+
|
142
|
+
it 'works for ssv' do
|
143
|
+
expect(api_client.build_collection_param(param, :ssv)).to eq('aa bb cc')
|
144
|
+
end
|
145
|
+
|
146
|
+
it 'works for tsv' do
|
147
|
+
expect(api_client.build_collection_param(param, :tsv)).to eq("aa\tbb\tcc")
|
148
|
+
end
|
149
|
+
|
150
|
+
it 'works for pipes' do
|
151
|
+
expect(api_client.build_collection_param(param, :pipes)).to eq('aa|bb|cc')
|
152
|
+
end
|
153
|
+
|
154
|
+
it 'works for multi' do
|
155
|
+
expect(api_client.build_collection_param(param, :multi)).to eq(['aa', 'bb', 'cc'])
|
156
|
+
end
|
157
|
+
|
158
|
+
it 'fails for invalid collection format' do
|
159
|
+
expect { api_client.build_collection_param(param, :INVALID) }.to raise_error(RuntimeError, 'unknown collection format: :INVALID')
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
describe '#json_mime?' do
|
164
|
+
let(:api_client) { PluralKitAPI::ApiClient.new }
|
165
|
+
|
166
|
+
it 'works' do
|
167
|
+
expect(api_client.json_mime?(nil)).to eq false
|
168
|
+
expect(api_client.json_mime?('')).to eq false
|
169
|
+
|
170
|
+
expect(api_client.json_mime?('application/json')).to eq true
|
171
|
+
expect(api_client.json_mime?('application/json; charset=UTF8')).to eq true
|
172
|
+
expect(api_client.json_mime?('APPLICATION/JSON')).to eq true
|
173
|
+
|
174
|
+
expect(api_client.json_mime?('application/xml')).to eq false
|
175
|
+
expect(api_client.json_mime?('text/plain')).to eq false
|
176
|
+
expect(api_client.json_mime?('application/jsonp')).to eq false
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
180
|
+
describe '#select_header_accept' do
|
181
|
+
let(:api_client) { PluralKitAPI::ApiClient.new }
|
182
|
+
|
183
|
+
it 'works' do
|
184
|
+
expect(api_client.select_header_accept(nil)).to be_nil
|
185
|
+
expect(api_client.select_header_accept([])).to be_nil
|
186
|
+
|
187
|
+
expect(api_client.select_header_accept(['application/json'])).to eq('application/json')
|
188
|
+
expect(api_client.select_header_accept(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
|
189
|
+
expect(api_client.select_header_accept(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
|
190
|
+
|
191
|
+
expect(api_client.select_header_accept(['application/xml'])).to eq('application/xml')
|
192
|
+
expect(api_client.select_header_accept(['text/html', 'application/xml'])).to eq('text/html,application/xml')
|
193
|
+
end
|
194
|
+
end
|
195
|
+
|
196
|
+
describe '#select_header_content_type' do
|
197
|
+
let(:api_client) { PluralKitAPI::ApiClient.new }
|
198
|
+
|
199
|
+
it 'works' do
|
200
|
+
expect(api_client.select_header_content_type(nil)).to eq('application/json')
|
201
|
+
expect(api_client.select_header_content_type([])).to eq('application/json')
|
202
|
+
|
203
|
+
expect(api_client.select_header_content_type(['application/json'])).to eq('application/json')
|
204
|
+
expect(api_client.select_header_content_type(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
|
205
|
+
expect(api_client.select_header_content_type(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
|
206
|
+
expect(api_client.select_header_content_type(['application/xml'])).to eq('application/xml')
|
207
|
+
expect(api_client.select_header_content_type(['text/plain', 'application/xml'])).to eq('text/plain')
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
211
|
+
describe '#sanitize_filename' do
|
212
|
+
let(:api_client) { PluralKitAPI::ApiClient.new }
|
213
|
+
|
214
|
+
it 'works' do
|
215
|
+
expect(api_client.sanitize_filename('sun')).to eq('sun')
|
216
|
+
expect(api_client.sanitize_filename('sun.gif')).to eq('sun.gif')
|
217
|
+
expect(api_client.sanitize_filename('../sun.gif')).to eq('sun.gif')
|
218
|
+
expect(api_client.sanitize_filename('/var/tmp/sun.gif')).to eq('sun.gif')
|
219
|
+
expect(api_client.sanitize_filename('./sun.gif')).to eq('sun.gif')
|
220
|
+
expect(api_client.sanitize_filename('..\sun.gif')).to eq('sun.gif')
|
221
|
+
expect(api_client.sanitize_filename('\var\tmp\sun.gif')).to eq('sun.gif')
|
222
|
+
expect(api_client.sanitize_filename('c:\var\tmp\sun.gif')).to eq('sun.gif')
|
223
|
+
expect(api_client.sanitize_filename('.\sun.gif')).to eq('sun.gif')
|
224
|
+
end
|
225
|
+
end
|
226
|
+
end
|