repltalk 1.2.0 → 2.0.3
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 +4 -4
- data/lib/queries.rb +108 -2
- data/lib/repltalk.rb +137 -17
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e6ea03b8b7ed292b98d72d5d221d74d66aefc4daffea069349115273729b0b3d
|
4
|
+
data.tar.gz: 650883b757e95b3509d22221855a8c0b868da61149b12efe24b79d19b4436cf7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 825db510c06db9c763e99cd585a4e7e396aa94a04b90e9615efd8ebc661d88d413b978f3f950869fa99e7f1b5bcdee54c388664ad7c066a404cfbe0718d8cb3a
|
7
|
+
data.tar.gz: 7badfaf3cae0930a7c4927d3cbd32ce8a675e7acd7ef37534e0d0541f783c9a347f661819cf65400e94e89fe6a306616817618e466005490ae0f087931d3baab
|
data/lib/queries.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
class
|
1
|
+
class Fields
|
2
2
|
@@roles = "
|
3
3
|
id
|
4
4
|
name
|
@@ -141,8 +141,10 @@ class Queries
|
|
141
141
|
#{@@comment}
|
142
142
|
}
|
143
143
|
"
|
144
|
+
end
|
144
145
|
|
145
146
|
|
147
|
+
class Queries < Fields
|
146
148
|
def Queries.get_user
|
147
149
|
"query userByUsername($username: String!) {
|
148
150
|
user: userByUsername(username: $username) {
|
@@ -298,6 +300,17 @@ class Queries
|
|
298
300
|
}"
|
299
301
|
end
|
300
302
|
|
303
|
+
def Queries.get_repl_comment
|
304
|
+
"query ReplViewComment($id: Int!) {
|
305
|
+
replComment(id: $id) {
|
306
|
+
... on ReplComment {
|
307
|
+
#{@@repl_comment}
|
308
|
+
}
|
309
|
+
}
|
310
|
+
}"
|
311
|
+
end
|
312
|
+
|
313
|
+
|
301
314
|
def Queries.get_board
|
302
315
|
"query boardBySlug($slug: String!) {
|
303
316
|
board: boardBySlug(slug: $slug) {
|
@@ -329,7 +342,7 @@ class Queries
|
|
329
342
|
end
|
330
343
|
|
331
344
|
|
332
|
-
class Mutations <
|
345
|
+
class Mutations < Fields
|
333
346
|
def Mutations.create_post
|
334
347
|
"mutation createPost($input: CreatePostInput!) {
|
335
348
|
createPost(input: $input) {
|
@@ -340,6 +353,25 @@ class Mutations < Queries
|
|
340
353
|
}"
|
341
354
|
end
|
342
355
|
|
356
|
+
def Mutations.edit_post
|
357
|
+
"mutation updatePost($input: UpdatePostInput!) {
|
358
|
+
updatePost(input: $input) {
|
359
|
+
post {
|
360
|
+
#{@@post}
|
361
|
+
}
|
362
|
+
}
|
363
|
+
}
|
364
|
+
"
|
365
|
+
end
|
366
|
+
|
367
|
+
def Mutations.delete_post
|
368
|
+
"mutation deletePost($id: Int!) {
|
369
|
+
deletePost(id: $id) {
|
370
|
+
id
|
371
|
+
}
|
372
|
+
}"
|
373
|
+
end
|
374
|
+
|
343
375
|
def Mutations.create_comment
|
344
376
|
"mutation createComment($input: CreateCommentInput!) {
|
345
377
|
createComment(input: $input) {
|
@@ -349,4 +381,78 @@ class Mutations < Queries
|
|
349
381
|
}
|
350
382
|
}"
|
351
383
|
end
|
384
|
+
|
385
|
+
def Mutations.edit_comment
|
386
|
+
"mutation updateComment($input: UpdateCommentInput!) {
|
387
|
+
updateComment(input: $input) {
|
388
|
+
comment {
|
389
|
+
#{@@comment}
|
390
|
+
}
|
391
|
+
}
|
392
|
+
}"
|
393
|
+
end
|
394
|
+
|
395
|
+
def Mutations.delete_comment
|
396
|
+
"mutation deleteComment($id: Int!) {
|
397
|
+
deleteComment(id: $id) {
|
398
|
+
id
|
399
|
+
}
|
400
|
+
}"
|
401
|
+
end
|
402
|
+
|
403
|
+
def Mutations.create_repl_comment
|
404
|
+
"mutation ReplViewCreateReplComment($input: CreateReplCommentInput!) {
|
405
|
+
createReplComment(input: $input) {
|
406
|
+
... on ReplComment {
|
407
|
+
#{@@repl_comment}
|
408
|
+
}
|
409
|
+
}
|
410
|
+
}"
|
411
|
+
end
|
412
|
+
|
413
|
+
def Mutations.reply_repl_comment
|
414
|
+
"mutation ReplViewCreateReplCommentReply($input: CreateReplCommentReplyInput!) {
|
415
|
+
createReplCommentReply(input: $input) {
|
416
|
+
... on ReplComment {
|
417
|
+
#{@@repl_comment}
|
418
|
+
}
|
419
|
+
}
|
420
|
+
}"
|
421
|
+
end
|
422
|
+
|
423
|
+
def Mutations.edit_repl_comment
|
424
|
+
"mutation ReplViewCommentsUpdateReplComment($input: UpdateReplCommentInput!) {
|
425
|
+
updateReplComment(input: $input) {
|
426
|
+
... on ReplComment {
|
427
|
+
#{@@repl_comment}
|
428
|
+
}
|
429
|
+
}
|
430
|
+
}"
|
431
|
+
end
|
432
|
+
|
433
|
+
def Mutations.delete_repl_comment
|
434
|
+
"mutation ReplViewCommentsDeleteReplComment($id: Int!) {
|
435
|
+
deleteReplComment(id: $id) {
|
436
|
+
... on ReplComment {
|
437
|
+
id
|
438
|
+
}
|
439
|
+
}
|
440
|
+
}"
|
441
|
+
end
|
442
|
+
|
443
|
+
def Mutations.report_post
|
444
|
+
"mutation createBoardReport($id: Int!, $reason: String!) {
|
445
|
+
createBoardReport(postId: $id, reason: $reason) {
|
446
|
+
id
|
447
|
+
}
|
448
|
+
}"
|
449
|
+
end
|
450
|
+
|
451
|
+
def Mutations.report_comment
|
452
|
+
"mutation createBoardReport($id: Int!, $reason: String!) {
|
453
|
+
createBoardReport(commentId: $id, reason: $reason) {
|
454
|
+
id
|
455
|
+
}
|
456
|
+
}"
|
457
|
+
end
|
352
458
|
end
|
data/lib/repltalk.rb
CHANGED
@@ -76,6 +76,23 @@ end
|
|
76
76
|
|
77
77
|
|
78
78
|
|
79
|
+
class Board
|
80
|
+
attr_reader :id, :name, :color, :description
|
81
|
+
|
82
|
+
def initialize(board)
|
83
|
+
@id = board["id"]
|
84
|
+
@name = board["name"]
|
85
|
+
@color = board["color"]
|
86
|
+
@description = board["description"]
|
87
|
+
end
|
88
|
+
|
89
|
+
def to_s
|
90
|
+
@name
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
|
95
|
+
|
79
96
|
class ReplComment
|
80
97
|
attr_reader :id, :content, :author, :repl, :replies
|
81
98
|
|
@@ -89,6 +106,40 @@ class ReplComment
|
|
89
106
|
@replies = comment["replies"] == nil ? nil : comment["replies"].map { |c| ReplComment.new(@client, c) }
|
90
107
|
end
|
91
108
|
|
109
|
+
def create_comment(content)
|
110
|
+
c = @client.graphql(
|
111
|
+
"ReplViewCreateReplCommentReply",
|
112
|
+
Mutations.reply_repl_comment,
|
113
|
+
input: {
|
114
|
+
replCommentId: @id,
|
115
|
+
body: content
|
116
|
+
}
|
117
|
+
)
|
118
|
+
ReplComment.new(@client, c["createReplCommentReply"])
|
119
|
+
end
|
120
|
+
|
121
|
+
def edit(content)
|
122
|
+
c = @client.graphql(
|
123
|
+
"ReplViewCommentsUpdateReplComment",
|
124
|
+
Mutations.edit_repl_comment,
|
125
|
+
input: {
|
126
|
+
id: @id,
|
127
|
+
body: content
|
128
|
+
}
|
129
|
+
)
|
130
|
+
puts c
|
131
|
+
ReplComment.new(@client, c["updateReplComment"])
|
132
|
+
end
|
133
|
+
|
134
|
+
def delete
|
135
|
+
@client.graphql(
|
136
|
+
"ReplViewCommentsDeleteReplComment",
|
137
|
+
Mutations.delete_repl_comment,
|
138
|
+
id: @id
|
139
|
+
)
|
140
|
+
nil
|
141
|
+
end
|
142
|
+
|
92
143
|
def to_s
|
93
144
|
@content
|
94
145
|
end
|
@@ -138,25 +189,20 @@ class Repl
|
|
138
189
|
c["repl"]["comments"]["items"].map { |comment| ReplComment.new(@client, comment) }
|
139
190
|
end
|
140
191
|
|
141
|
-
def
|
142
|
-
@
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
def initialize(board)
|
152
|
-
@id = board["id"]
|
153
|
-
@name = board["name"]
|
154
|
-
@color = board["color"]
|
155
|
-
@description = board["description"]
|
192
|
+
def create_comment(content)
|
193
|
+
c = @client.graphql(
|
194
|
+
"ReplViewCreateReplComment",
|
195
|
+
Mutations.create_repl_comment,
|
196
|
+
input: {
|
197
|
+
replId: @id,
|
198
|
+
body: content
|
199
|
+
}
|
200
|
+
)
|
201
|
+
ReplComment.new(@client, c["createReplComment"])
|
156
202
|
end
|
157
203
|
|
158
204
|
def to_s
|
159
|
-
@
|
205
|
+
@title
|
160
206
|
end
|
161
207
|
end
|
162
208
|
|
@@ -221,6 +267,37 @@ class Comment
|
|
221
267
|
Comment.new(@client, c["createComment"]["comment"])
|
222
268
|
end
|
223
269
|
|
270
|
+
def edit(content)
|
271
|
+
c = @client.graphql(
|
272
|
+
"updateComment",
|
273
|
+
Mutations.edit_comment,
|
274
|
+
input: {
|
275
|
+
id: @id,
|
276
|
+
body: content
|
277
|
+
}
|
278
|
+
)
|
279
|
+
Comment.new(@client, c["updateComment"]["comment"])
|
280
|
+
end
|
281
|
+
|
282
|
+
def delete
|
283
|
+
@client.graphql(
|
284
|
+
"deleteComment",
|
285
|
+
Mutations.delete_comment,
|
286
|
+
id: @id
|
287
|
+
)
|
288
|
+
nil
|
289
|
+
end
|
290
|
+
|
291
|
+
def report(reason)
|
292
|
+
@client.graphql(
|
293
|
+
"createBoardReport",
|
294
|
+
Mutations.report_comment,
|
295
|
+
id: @id,
|
296
|
+
reason: reason
|
297
|
+
)
|
298
|
+
nil
|
299
|
+
end
|
300
|
+
|
224
301
|
def to_s
|
225
302
|
@content
|
226
303
|
end
|
@@ -295,6 +372,40 @@ class Post
|
|
295
372
|
Comment.new(@client, c["createComment"]["comment"])
|
296
373
|
end
|
297
374
|
|
375
|
+
def edit(title: @title, content: @content, repl_id: @repl.id, show_hosted: false)
|
376
|
+
p = @client.graphql(
|
377
|
+
"updatePost",
|
378
|
+
Mutations.edit_post,
|
379
|
+
input: {
|
380
|
+
id: @id,
|
381
|
+
title: title,
|
382
|
+
body: content,
|
383
|
+
replId: repl_id,
|
384
|
+
showHosted: show_hosted
|
385
|
+
}
|
386
|
+
)
|
387
|
+
Post.new(@client, p["updatePost"]["post"])
|
388
|
+
end
|
389
|
+
|
390
|
+
def delete
|
391
|
+
@client.graphql(
|
392
|
+
"deletePost",
|
393
|
+
Mutations.delete_post,
|
394
|
+
id: @id
|
395
|
+
)
|
396
|
+
nil
|
397
|
+
end
|
398
|
+
|
399
|
+
def report(reason)
|
400
|
+
@client.graphql(
|
401
|
+
"createBoardReport",
|
402
|
+
Mutations.report_post,
|
403
|
+
id: @id,
|
404
|
+
reason: reason
|
405
|
+
)
|
406
|
+
nil
|
407
|
+
end
|
408
|
+
|
298
409
|
def to_s
|
299
410
|
@title
|
300
411
|
end
|
@@ -463,6 +574,15 @@ class Client
|
|
463
574
|
Repl.new(self, r["repl"])
|
464
575
|
end
|
465
576
|
|
577
|
+
def get_repl_comment(id)
|
578
|
+
c = graphql(
|
579
|
+
"ReplViewComment",
|
580
|
+
Queries.get_repl_comment,
|
581
|
+
id: id
|
582
|
+
)
|
583
|
+
ReplComment.new(self, c["replComment"])
|
584
|
+
end
|
585
|
+
|
466
586
|
def get_board(name)
|
467
587
|
b = graphql(
|
468
588
|
"boardBySlug",
|
@@ -487,7 +607,7 @@ class Client
|
|
487
607
|
p = graphql(
|
488
608
|
"PostsFeed",
|
489
609
|
Queries.get_posts,
|
490
|
-
|
610
|
+
boardSlugs: [board],
|
491
611
|
order: order,
|
492
612
|
count: count,
|
493
613
|
after: after,
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: repltalk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- CodingCactus
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-03-
|
11
|
+
date: 2021-03-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http
|