nexus-invision 1.9.0 → 1.10.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/nexus/invision/client.rb +28 -24
- data/lib/nexus/invision/client_interface.rb +97 -0
- data/lib/nexus/invision/value_object.rb +1 -1
- data/lib/nexus/invision/version.rb +2 -2
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf10a8da5ec2072130dbedb0d765bcbc9c24acd4400f06ab97e5bf63fbae1d76
|
4
|
+
data.tar.gz: 924f770f88d420759088e00832205ff55d687b41c4dc1afb8a9064681a5c1fde
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b421b755ce1379a81ea8ee231d9b1e2a4374edb073d32066f2395e187da6dc512448183ae967adf3cea7f92c8f596db5c17b403ab30705df7f7b17df68639c8f
|
7
|
+
data.tar.gz: 79e1642bdab18d0a217d2d35dd4adfee945377acfce144f5ca2ee1491bac2ba5096866772e919f4452c131038470d50072e57fff2a43a666745f34a0889d9d9b
|
@@ -2,6 +2,7 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
require "faraday"
|
5
|
+
require "nexus/invision/client_interface"
|
5
6
|
require "nexus/invision/errors/bad_request"
|
6
7
|
require "nexus/invision/errors/unexpected_response"
|
7
8
|
require "nexus/invision/requests/add_member_to_secondary_group"
|
@@ -41,11 +42,9 @@ module Nexus
|
|
41
42
|
|
42
43
|
class Client
|
43
44
|
extend T::Sig
|
45
|
+
extend T::Helpers
|
44
46
|
|
45
|
-
|
46
|
-
def initialize(connection)
|
47
|
-
@connection = connection
|
48
|
-
end
|
47
|
+
include ClientInterface
|
49
48
|
|
50
49
|
class << self
|
51
50
|
extend T::Sig
|
@@ -55,7 +54,7 @@ module Nexus
|
|
55
54
|
base_url: URI::HTTP,
|
56
55
|
api_key: String,
|
57
56
|
block: T.nilable(T.proc.params(arg0: Faraday::Connection).void),
|
58
|
-
).returns(
|
57
|
+
).returns(ClientInterface)
|
59
58
|
end
|
60
59
|
def build(base_url:, api_key:, &block)
|
61
60
|
new(
|
@@ -69,7 +68,12 @@ module Nexus
|
|
69
68
|
end
|
70
69
|
end
|
71
70
|
|
72
|
-
sig { params(
|
71
|
+
sig { params(connection: Faraday::Connection).void }
|
72
|
+
def initialize(connection)
|
73
|
+
@connection = connection
|
74
|
+
end
|
75
|
+
|
76
|
+
sig { override.params(post_id: Integer).void }
|
73
77
|
def delete_post(post_id)
|
74
78
|
request(
|
75
79
|
http_method: HTTPMethod::DELETE,
|
@@ -77,7 +81,7 @@ module Nexus
|
|
77
81
|
)
|
78
82
|
end
|
79
83
|
|
80
|
-
sig { params(topic_id: Integer).void }
|
84
|
+
sig { override.params(topic_id: Integer).void }
|
81
85
|
def delete_topic(topic_id)
|
82
86
|
request(
|
83
87
|
http_method: HTTPMethod::DELETE,
|
@@ -85,7 +89,7 @@ module Nexus
|
|
85
89
|
)
|
86
90
|
end
|
87
91
|
|
88
|
-
sig { params(post_id: Integer).returns(Resources::Post) }
|
92
|
+
sig { override.params(post_id: Integer).returns(Resources::Post) }
|
89
93
|
def get_post(post_id)
|
90
94
|
response = request(
|
91
95
|
http_method: HTTPMethod::GET,
|
@@ -95,7 +99,7 @@ module Nexus
|
|
95
99
|
Resources::Post.from_hash(response.body)
|
96
100
|
end
|
97
101
|
|
98
|
-
sig { params(request: Requests::ListForumTopics).returns(Resources::Page[Resources::Topic]) }
|
102
|
+
sig { override.params(request: Requests::ListForumTopics).returns(Resources::Page[Resources::Topic]) }
|
99
103
|
def list_forum_topics(request)
|
100
104
|
response = request(
|
101
105
|
http_method: HTTPMethod::GET,
|
@@ -114,7 +118,7 @@ module Nexus
|
|
114
118
|
)
|
115
119
|
end
|
116
120
|
|
117
|
-
sig { params(request: Requests::CreateForumTopic).returns(Resources::Topic) }
|
121
|
+
sig { override.params(request: Requests::CreateForumTopic).returns(Resources::Topic) }
|
118
122
|
def create_forum_topic(request)
|
119
123
|
response = request(
|
120
124
|
http_method: HTTPMethod::POST,
|
@@ -125,7 +129,7 @@ module Nexus
|
|
125
129
|
Resources::Topic.from_hash(response.body)
|
126
130
|
end
|
127
131
|
|
128
|
-
sig { params(request: Requests::CreateForumPost).returns(Resources::Post) }
|
132
|
+
sig { override.params(request: Requests::CreateForumPost).returns(Resources::Post) }
|
129
133
|
def create_forum_post(request)
|
130
134
|
response = request(
|
131
135
|
http_method: HTTPMethod::POST,
|
@@ -136,7 +140,7 @@ module Nexus
|
|
136
140
|
Resources::Post.from_hash(response.body)
|
137
141
|
end
|
138
142
|
|
139
|
-
sig { params(nexusmods_member_id: Integer).returns(Resources::LoginLink) }
|
143
|
+
sig { override.params(nexusmods_member_id: Integer).returns(Resources::LoginLink) }
|
140
144
|
def login_link(nexusmods_member_id)
|
141
145
|
response = request(
|
142
146
|
http_method: HTTPMethod::GET,
|
@@ -146,7 +150,7 @@ module Nexus
|
|
146
150
|
Resources::LoginLink.from_hash(response.body)
|
147
151
|
end
|
148
152
|
|
149
|
-
sig { params(nexusmods_member_id: Integer).returns(Resources::Member) }
|
153
|
+
sig { override.params(nexusmods_member_id: Integer).returns(Resources::Member) }
|
150
154
|
def get_member(nexusmods_member_id)
|
151
155
|
response = request(
|
152
156
|
http_method: HTTPMethod::GET,
|
@@ -156,7 +160,7 @@ module Nexus
|
|
156
160
|
Resources::Member.from_hash(response.body)
|
157
161
|
end
|
158
162
|
|
159
|
-
sig { params(request: Requests::EnsureMember).returns(Resources::EnsureMember) }
|
163
|
+
sig { override.params(request: Requests::EnsureMember).returns(Resources::EnsureMember) }
|
160
164
|
def ensure_member(request)
|
161
165
|
response = request(
|
162
166
|
http_method: HTTPMethod::POST,
|
@@ -167,7 +171,7 @@ module Nexus
|
|
167
171
|
Resources::EnsureMember.from_hash(response.body)
|
168
172
|
end
|
169
173
|
|
170
|
-
sig { params(request: Requests::CreateMessage).void }
|
174
|
+
sig { override.params(request: Requests::CreateMessage).void }
|
171
175
|
def create_message(request)
|
172
176
|
request(
|
173
177
|
http_method: HTTPMethod::POST,
|
@@ -176,7 +180,7 @@ module Nexus
|
|
176
180
|
)
|
177
181
|
end
|
178
182
|
|
179
|
-
sig { params(request: Requests::UnreadCount).returns(Resources::UnreadCount) }
|
183
|
+
sig { override.params(request: Requests::UnreadCount).returns(Resources::UnreadCount) }
|
180
184
|
def unread_count(request)
|
181
185
|
response = request(
|
182
186
|
http_method: HTTPMethod::GET,
|
@@ -186,7 +190,7 @@ module Nexus
|
|
186
190
|
Resources::UnreadCount.from_hash(response.body)
|
187
191
|
end
|
188
192
|
|
189
|
-
sig { params(request: Requests::EditMemberPrimaryGroup).returns(Resources::Member) }
|
193
|
+
sig { override.params(request: Requests::EditMemberPrimaryGroup).returns(Resources::Member) }
|
190
194
|
def edit_member_primary_group(request)
|
191
195
|
response = request(
|
192
196
|
http_method: HTTPMethod::POST,
|
@@ -196,7 +200,7 @@ module Nexus
|
|
196
200
|
Resources::Member.from_hash(response.body)
|
197
201
|
end
|
198
202
|
|
199
|
-
sig { params(request: Requests::AddMemberToSecondaryGroup).returns(Resources::User) }
|
203
|
+
sig { override.params(request: Requests::AddMemberToSecondaryGroup).returns(Resources::User) }
|
200
204
|
def add_member_to_secondary_group(request)
|
201
205
|
response = request(
|
202
206
|
http_method: HTTPMethod::POST,
|
@@ -206,7 +210,7 @@ module Nexus
|
|
206
210
|
Resources::User.from_hash(response.body)
|
207
211
|
end
|
208
212
|
|
209
|
-
sig { params(request: Requests::RemoveMemberFromSecondaryGroup).returns(Resources::User) }
|
213
|
+
sig { override.params(request: Requests::RemoveMemberFromSecondaryGroup).returns(Resources::User) }
|
210
214
|
def remove_member_from_secondary_group(request)
|
211
215
|
response = request(
|
212
216
|
http_method: HTTPMethod::DELETE,
|
@@ -216,7 +220,7 @@ module Nexus
|
|
216
220
|
Resources::User.from_hash(response.body)
|
217
221
|
end
|
218
222
|
|
219
|
-
sig { params(request: Requests::CreateMemberWarning).returns(Resources::Warning) }
|
223
|
+
sig { override.params(request: Requests::CreateMemberWarning).returns(Resources::Warning) }
|
220
224
|
def create_member_warning(request)
|
221
225
|
response = request(
|
222
226
|
http_method: HTTPMethod::POST,
|
@@ -227,7 +231,7 @@ module Nexus
|
|
227
231
|
Resources::Warning.from_hash(response.body)
|
228
232
|
end
|
229
233
|
|
230
|
-
sig { params(member_id: Integer).returns(Resources::User) }
|
234
|
+
sig { override.params(member_id: Integer).returns(Resources::User) }
|
231
235
|
def ban_member(member_id)
|
232
236
|
response = request(
|
233
237
|
http_method: HTTPMethod::POST,
|
@@ -237,7 +241,7 @@ module Nexus
|
|
237
241
|
Resources::User.from_hash(response.body)
|
238
242
|
end
|
239
243
|
|
240
|
-
sig { params(member_id: Integer).returns(Resources::User) }
|
244
|
+
sig { override.params(member_id: Integer).returns(Resources::User) }
|
241
245
|
def unban_member(member_id)
|
242
246
|
response = request(
|
243
247
|
http_method: HTTPMethod::DELETE,
|
@@ -247,7 +251,7 @@ module Nexus
|
|
247
251
|
Resources::User.from_hash(response.body)
|
248
252
|
end
|
249
253
|
|
250
|
-
sig { params(request: Requests::DeleteMember).void }
|
254
|
+
sig { override.params(request: Requests::DeleteMember).void }
|
251
255
|
def delete_member(request)
|
252
256
|
# 1 is keep member name, 0 is anonymize content
|
253
257
|
values = request.serialize.except("member_id").merge({ "contentAnonymize" => request.keep_member_name ? 1 : 0 })
|
@@ -258,7 +262,7 @@ module Nexus
|
|
258
262
|
)
|
259
263
|
end
|
260
264
|
|
261
|
-
sig { params(request: Requests::EditMember).returns(Resources::User) }
|
265
|
+
sig { override.params(request: Requests::EditMember).returns(Resources::User) }
|
262
266
|
def edit_member(request)
|
263
267
|
response = request(
|
264
268
|
http_method: HTTPMethod::POST,
|
@@ -0,0 +1,97 @@
|
|
1
|
+
# typed: strict
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require "faraday"
|
5
|
+
require "nexus/invision/errors/bad_request"
|
6
|
+
require "nexus/invision/errors/unexpected_response"
|
7
|
+
require "nexus/invision/requests/add_member_to_secondary_group"
|
8
|
+
require "nexus/invision/requests/create_forum_post"
|
9
|
+
require "nexus/invision/requests/create_forum_topic"
|
10
|
+
require "nexus/invision/requests/create_member_warning"
|
11
|
+
require "nexus/invision/requests/create_message"
|
12
|
+
require "nexus/invision/requests/delete_member"
|
13
|
+
require "nexus/invision/requests/edit_member"
|
14
|
+
require "nexus/invision/requests/list_forum_topics"
|
15
|
+
require "nexus/invision/requests/remove_member_from_secondary_group"
|
16
|
+
require "nexus/invision/requests/edit_member_primary_group"
|
17
|
+
require "nexus/invision/requests/ensure_member"
|
18
|
+
require "nexus/invision/requests/unread_count"
|
19
|
+
require "nexus/invision/resources/group"
|
20
|
+
require "nexus/invision/resources/login_link"
|
21
|
+
require "nexus/invision/resources/member"
|
22
|
+
require "nexus/invision/resources/page"
|
23
|
+
require "nexus/invision/resources/post"
|
24
|
+
require "nexus/invision/resources/topic"
|
25
|
+
require "nexus/invision/resources/user"
|
26
|
+
require "nexus/invision/resources/warning"
|
27
|
+
require "nexus/invision/resources/ensure_member"
|
28
|
+
require "nexus/invision/resources/unread_count"
|
29
|
+
require "sorbet-runtime"
|
30
|
+
require "uri"
|
31
|
+
|
32
|
+
module Nexus
|
33
|
+
module Invision
|
34
|
+
module ClientInterface
|
35
|
+
extend T::Sig
|
36
|
+
extend T::Helpers
|
37
|
+
interface!
|
38
|
+
|
39
|
+
sig { abstract.params(post_id: Integer).void }
|
40
|
+
def delete_post(post_id) end
|
41
|
+
|
42
|
+
sig { abstract.params(topic_id: Integer).void }
|
43
|
+
def delete_topic(topic_id) end
|
44
|
+
|
45
|
+
sig { abstract.params(post_id: Integer).returns(Resources::Post) }
|
46
|
+
def get_post(post_id) end
|
47
|
+
|
48
|
+
sig { abstract.params(request: Requests::ListForumTopics).returns(Resources::Page[Resources::Topic]) }
|
49
|
+
def list_forum_topics(request) end
|
50
|
+
|
51
|
+
sig { abstract.params(request: Requests::CreateForumTopic).returns(Resources::Topic) }
|
52
|
+
def create_forum_topic(request) end
|
53
|
+
|
54
|
+
sig { abstract.params(request: Requests::CreateForumPost).returns(Resources::Post) }
|
55
|
+
def create_forum_post(request) end
|
56
|
+
|
57
|
+
sig { abstract.params(nexusmods_member_id: Integer).returns(Resources::LoginLink) }
|
58
|
+
def login_link(nexusmods_member_id) end
|
59
|
+
|
60
|
+
sig { abstract.params(nexusmods_member_id: Integer).returns(Resources::Member) }
|
61
|
+
def get_member(nexusmods_member_id) end
|
62
|
+
|
63
|
+
sig { abstract.params(request: Requests::EnsureMember).returns(Resources::EnsureMember) }
|
64
|
+
def ensure_member(request) end
|
65
|
+
|
66
|
+
sig { abstract.params(request: Requests::CreateMessage).void }
|
67
|
+
def create_message(request) end
|
68
|
+
|
69
|
+
sig { abstract.params(request: Requests::UnreadCount).returns(Resources::UnreadCount) }
|
70
|
+
def unread_count(request) end
|
71
|
+
|
72
|
+
sig { abstract.params(request: Requests::EditMemberPrimaryGroup).returns(Resources::Member) }
|
73
|
+
def edit_member_primary_group(request) end
|
74
|
+
|
75
|
+
sig { abstract.params(request: Requests::AddMemberToSecondaryGroup).returns(Resources::User) }
|
76
|
+
def add_member_to_secondary_group(request) end
|
77
|
+
|
78
|
+
sig { abstract.params(request: Requests::RemoveMemberFromSecondaryGroup).returns(Resources::User) }
|
79
|
+
def remove_member_from_secondary_group(request) end
|
80
|
+
|
81
|
+
sig { abstract.params(request: Requests::CreateMemberWarning).returns(Resources::Warning) }
|
82
|
+
def create_member_warning(request) end
|
83
|
+
|
84
|
+
sig { abstract.params(member_id: Integer).returns(Resources::User) }
|
85
|
+
def ban_member(member_id) end
|
86
|
+
|
87
|
+
sig { abstract.params(member_id: Integer).returns(Resources::User) }
|
88
|
+
def unban_member(member_id) end
|
89
|
+
|
90
|
+
sig { abstract.params(request: Requests::DeleteMember).void }
|
91
|
+
def delete_member(request) end
|
92
|
+
|
93
|
+
sig { abstract.params(request: Requests::EditMember).returns(Resources::User) }
|
94
|
+
def edit_member(request) end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
@@ -17,7 +17,7 @@ module Nexus
|
|
17
17
|
sig { abstract.returns(T::Hash[String, T.untyped]) }
|
18
18
|
def serialize; end
|
19
19
|
|
20
|
-
sig { params(other:
|
20
|
+
sig { params(other: T.untyped).returns(T::Boolean) }
|
21
21
|
def eql?(other)
|
22
22
|
self.class == other.class && serialize == other.serialize
|
23
23
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nexus-invision
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.10.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jack Robertson
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-02-
|
11
|
+
date: 2024-02-20 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|
@@ -23,6 +23,7 @@ files:
|
|
23
23
|
- README.md
|
24
24
|
- Rakefile
|
25
25
|
- lib/nexus/invision/client.rb
|
26
|
+
- lib/nexus/invision/client_interface.rb
|
26
27
|
- lib/nexus/invision/errors/bad_request.rb
|
27
28
|
- lib/nexus/invision/errors/client_error.rb
|
28
29
|
- lib/nexus/invision/errors/unexpected_response.rb
|