-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathstrawpoll_v3.yml
More file actions
1128 lines (1127 loc) · 32.6 KB
/
strawpoll_v3.yml
File metadata and controls
1128 lines (1127 loc) · 32.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
openapi: 3.1.0
info:
title: StrawPoll API
description: 'This is the official StrawPoll API. If you have any questions or suggestions, feel free to contact support@strawpoll.com.'
contact:
email: support@strawpoll.com
name: StrawPoll Support
url: 'https://strawpoll.com/contact/'
x-twitter: strawpoll_com
version: 3.1.0
termsOfService: 'https://strawpoll.com/terms/'
license:
name: CC BY SA 4.0
url: 'https://creativecommons.org/licenses/by-sa/4.0/'
x-logo:
url: 'https://strawpoll.com/images/strawpoll/strawpoll.png'
x-providerName: StrawPoll
externalDocs:
description: StrawPoll Help Center
url: 'https://strawpoll.com/help/'
servers:
- url: 'https://api.strawpoll.com/v3'
description: API endpoint
tags:
- name: Polls
description: Poll related endpoints
- name: Current user
description: Current user related endpoints
- name: Users
description: User related endpoints
- name: Comments
description: Comment related endpoints
- name: Media
description: Media related endpoints
paths:
/users/@me:
get:
operationId: GetCurrentUser
description: Get the current user.
tags:
- Current user
responses:
'200':
description: Returns the User object for the current user.
content:
application/json:
schema:
$ref: '#/components/schemas/User'
patch:
operationId: UpdateCurrentUser
description: Applies a partial update to the current user.
tags:
- Current user
requestBody:
description: Submit a partial User object to update the corresponding fields (see examples below).
content:
application/json:
schema:
anyOf:
- type: object
properties:
displayname:
type: string
example: John Doe
- type: object
properties:
user_meta:
type: object
properties:
about:
type: string
example: A brief description for your public profile.
responses:
'200':
description: Returns the updated User object for the current user on success
content:
application/json:
schema:
$ref: '#/components/schemas/User'
/users/@me/polls:
get:
operationId: ListCurrentUserPolls
description: Returns a list of polls related to the current user as well as pagination information.
tags:
- Current user
parameters:
- name: type
in: query
description: created or participated
required: true
style: form
explode: true
schema:
type: string
responses:
'200':
description: Returns a list of Poll objects related to the current user as well as pagination information.
content:
application/json:
schema:
type: object
properties:
data:
type: array
items:
$ref: '#/components/schemas/Poll'
pagination:
$ref: '#/components/schemas/Pagination'
/users/@me/activities:
get:
operationId: ListCurrentUserActivities
description: Returns a list of activities for the current user as well as pagination information.
tags:
- Current user
responses:
'200':
description: Returns a list of UserActivity objects related to the current user
content:
application/json:
schema:
type: object
properties:
data:
type: array
items:
$ref: '#/components/schemas/UserActivity'
pagination:
$ref: '#/components/schemas/Pagination'
'/users/{user_id}':
get:
operationId: GetUser
description: Get the PublicUser object for a given user id.
tags:
- Users
parameters:
- name: user_id
in: path
description: The user id of a user.
required: true
style: simple
explode: false
schema:
type: string
responses:
'200':
description: Returns the User object for the given user id.
content:
application/json:
schema:
$ref: '#/components/schemas/User'
'/users/{user_id}/polls':
get:
operationId: GetUserPolls
description: Returns a list of polls related to the given user id as well as pagination information.
tags:
- Users
parameters:
- name: user_id
in: path
description: user id
required: true
style: simple
explode: false
schema:
type: string
- name: type
in: query
description: created or participated
required: true
style: form
explode: true
schema:
type: string
responses:
'200':
description: Returns a list of Poll objects related to the given user id as well as pagination information.
content:
application/json:
schema:
type: object
properties:
data:
type: array
items:
$ref: '#/components/schemas/Poll'
pagination:
$ref: '#/components/schemas/Pagination'
/upload:
post:
operationId: uploadFile
tags:
- Media
description: Create a media object by uploading a file.
requestBody:
content:
multipart/form-data:
schema:
$ref: '#/components/schemas/Upload'
responses:
'201':
description: Returns the uploaded media object on success.
/media:
post:
operationId: createMedia
tags:
- Media
description: Create a media object by submitting an external file.
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Media'
required: true
responses:
'201':
description: Returns the submitted media object on success.
'/media/{media_id}':
get:
operationId: getMedia
description: Get the Media object for a given media id.
tags:
- Media
parameters:
- name: media_id
in: path
description: media id
required: true
style: simple
explode: false
schema:
type: string
responses:
'200':
description: Returns the media object for a given ID.
put:
operationId: updateMedia
description: Update a media file by passing a Media object.
tags:
- Media
parameters:
- name: media_id
in: path
description: media id
required: true
style: simple
explode: false
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Media'
required: true
responses:
'200':
description: Returns the updated media object on success.
delete:
operationId: deleteMedia
description: Deletes a specific media file.
tags:
- Media
parameters:
- name: media_id
in: path
description: media id
required: true
style: simple
explode: false
schema:
type: string
responses:
'204':
description: Returns an empty response on success.
/polls:
post:
operationId: createPoll
tags:
- Polls
description: Create a poll by passing a poll object.
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Poll'
required: true
responses:
'201':
description: Returns the created Poll object on success.
'400':
description: Bad input parameters
'500':
description: Server error
security:
- ApiKeyAuth:
- user
'/polls/{poll_id}':
get:
operationId: getPoll
tags:
- Polls
description: Get a Poll object for a given poll id.
parameters:
- name: poll_id
in: path
description: poll id
required: true
style: simple
explode: false
schema:
type: string
responses:
'200':
description: search results matching criteria
content:
application/json:
schema:
$ref: '#/components/schemas/Poll'
put:
operationId: updatePoll
tags:
- Polls
description: Update a poll by passing a Poll object.
parameters:
- name: poll_id
in: path
description: poll id
required: true
style: simple
explode: false
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Poll'
required: true
responses:
'200':
description: Returns the updated Poll object on success.
content:
application/json:
schema:
$ref: '#/components/schemas/Poll'
delete:
operationId: deletePoll
description: Delete a poll for a given poll id.
tags:
- Polls
parameters:
- name: poll_id
in: path
description: poll id
required: true
style: simple
explode: false
schema:
type: string
responses:
'204':
description: Returns an empty response on success.
'/polls/{poll_id}/results':
get:
operationId: getPollResults
description: Get the poll results for a given poll id.
tags:
- Polls
parameters:
- name: poll_id
in: path
description: poll id
required: true
style: simple
explode: false
schema:
type: string
responses:
'200':
description: results
content:
application/json:
schema:
$ref: '#/components/schemas/PollResults'
delete:
operationId: deletePollResults
description: Reset a poll by deleting the results for a given poll id. The deadline also gets reset.
tags:
- Polls
parameters:
- name: poll_id
in: path
description: poll id
required: true
style: simple
explode: false
schema:
type: string
responses:
'204':
description: Returns an empty response on success.
'/polls/{poll_id}/comments':
get:
operationId: getPollComments
description: Returns a list of comments related to the given poll id.
tags:
- Polls
parameters:
- name: poll_id
in: path
description: poll id
required: true
style: simple
explode: false
schema:
type: string
responses:
'200':
description: results
content:
application/json:
schema:
type: object
properties:
data:
type: array
items:
$ref: '#/components/schemas/Comment'
pagination:
$ref: '#/components/schemas/Pagination'
/comments:
post:
operationId: createComment
description: Create a comment by passing a Comment object.
tags:
- Comments
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Comment'
required: true
responses:
'201':
description: Returns the created comment object on success.
content:
application/json:
schema:
$ref: '#/components/schemas/Comment'
'/comments/{comment_id}':
get:
operationId: getComment
description: Get the comment object for a given comment id.
tags:
- Comments
parameters:
- name: comment_id
in: path
description: The ID of a comment
required: true
style: simple
explode: false
schema:
type: string
responses:
'200':
description: Returns the comment object for a given ID
content:
application/json:
schema:
$ref: '#/components/schemas/Comment'
put:
operationId: updateComment
description: Update a comment by passing a Comment object.
tags:
- Comments
parameters:
- name: comment_id
in: path
description: The ID of a comment
required: true
style: simple
explode: false
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Comment'
required: true
responses:
'200':
description: Returns the updated comment object on success
content:
application/json:
schema:
$ref: '#/components/schemas/Comment'
delete:
operationId: deleteComment
description: Delete a comment for a given comment in.
tags:
- Comments
parameters:
- name: comment_id
in: path
description: The ID of a comment
required: true
style: simple
explode: false
schema:
type: string
responses:
'204':
description: Successfully deleted comment
components:
schemas:
Poll:
required:
- poll_options
- title
- type
type: object
properties:
id:
type: string
readOnly: true
example: NPgxkzPqrn2
title:
type: string
example: What type of content do you want to see more of in the future?
user:
$ref: '#/components/schemas/PublicUser'
media:
$ref: '#/components/schemas/Media'
poll_options:
type: array
items:
anyOf:
- $ref: '#/components/schemas/TextPollOption'
- $ref: '#/components/schemas/ImagePollOption'
- $ref: '#/components/schemas/DatePollOption'
- $ref: '#/components/schemas/TimeRangePollOption'
poll_config:
$ref: '#/components/schemas/PollConfig'
poll_meta:
$ref: '#/components/schemas/PollMeta'
type:
type: string
enum:
- multiple_choice
- meeting
- ranked_choice
version:
type: string
format: uuid
readOnly: true
created_at:
type: integer
format: int64
readOnly: true
example: 1649671274
updated_at:
type: integer
format: int64
nullable: true
readOnly: true
example: 1649671274
reset_at:
type: integer
format: int64
nullable: true
readOnly: true
example: 1649671274
PollOption:
description: This is just the base model for various other poll option types.
type: object
properties:
id:
type: string
type:
type: string
description: 'possible poll option types, each type has unique properties'
enum:
- text
- image
- date
- time_range
position:
type: integer
description: 'the sorting of the poll option in the list, starting at 0'
vote_count:
type: integer
description: current vote count for this option
readOnly: true
max_votes:
type: integer
description: a limit of maximum allowed votes for this option
example: 0
description:
type: string
example: This is a description text
description: a secondary field for more information on the poll option
nullable: true
is_write_in:
type: boolean
description: whether the option was added by a participant or not
example: false
readOnly: true
TextPollOption:
description: A text-based poll option (default). The information is stored in the "value" field.
allOf:
- $ref: '#/components/schemas/PollOption'
- type: object
properties:
id:
example: B2ZBXVaAEnJ
type:
example: text
position:
example: 0
value:
example: Reactions
x-internal: false
examples:
- id: B2ZBXVaAEnJ
type: text
position: 0
vote_count: 0
max_votes: 0
description: string
is_write_in: false
value: Reactions
ImagePollOption:
description: 'An image-based poll option. The image information is stored in the "media" field, while a caption is stored in the "value" field. Currently not in use in the live version.'
allOf:
- $ref: '#/components/schemas/PollOption'
- type: object
properties:
id:
example: 61gDLOkK9gw
type:
example: image
position:
example: 1
media:
$ref: '#/components/schemas/Media'
value:
example: Image Caption
DatePollOption:
summary: A date-based poll option used for "All-day" meeting options. The information is stored in the "date" field.
allOf:
- $ref: '#/components/schemas/PollOption'
- type: object
properties:
id:
example: 05ZdvdbKDn6
type:
example: date
position:
example: 2
date:
type: string
format: date
TimeRangePollOption:
description: A time-range based poll option used for meeting polls. The information is stored in the "start_time" and "end_time" fields.
allOf:
- $ref: '#/components/schemas/PollOption'
- type: object
properties:
id:
example: jVyGJaBNzZ7
type:
example: time_range
position:
example: 3
start_time:
type: integer
format: int64
example: 1649671274
end_time:
type: integer
format: int64
example: 1649671274
PollConfig:
type: object
properties:
is_private:
type: boolean
example: true
description: Hidden from search, discover and public user profiles.
vote_type:
type: string
enum:
- default
- box_small
- participant_grid
description: Changes the layouts of how a voting is displayed.
allow_comments:
type: boolean
example: true
allow_indeterminate:
type: boolean
description: Only relevant in polls with participant grids. It adds the option to reply with "If need be".
example: false
allow_other_option:
type: boolean
description: Allows users to add custom options to your poll.
example: false
custom_design_colors:
type: string
description: Various RGB values for custom design colors of a poll page (stored as JSON). To apply it, use_custom_design must be set true.
nullable: true
example: '{}'
deadline_at:
type: integer
format: int64
example: 1649671274
nullable: true
description: Unixtime value of when a poll is closed.
duplication_checking:
type: string
enum:
- ip
- session
- invite
- none
description: Changes the way duplicate votes are handled.
allow_vpn_users:
type: boolean
example: false
description: Allow VPN users to vote
edit_vote_permissions:
type: string
enum:
- admin
- admin_voter
- voter
- nobody
description: Sets the permissions of who is allowed to edit votes. Only relevent when voters are required to enter their name.
force_appearance:
type: string
nullable: true
enum:
- auto
- dark
- light
description: By default, it is auto-detected whether a user wants to see a dark mode or not. This process can be forces to match the custom colors of a poll.
hide_participants:
type: boolean
example: false
description: Hiding participants is an option to remove the names of other participants from public view. Own votes are still visible to a participant.
is_multiple_choice:
type: boolean
example: true
description: By default, polls are set to allow only one answer. After activating this, you can choose also set multiple_choice_min and multiple_choice_max to define the allowed range of multiple choices.
multiple_choice_min:
type: integer
example: 1
description: The minimum number of options a voter has to choose. A value of 0 means unlimited.
multiple_choice_max:
type: integer
example: 2
description: The maximum number of options a voter has to choose. A value of 0 means unlimited.
number_of_winners:
type: integer
example: 1
description: After a poll is closed, winners can be declared. This indicates how many options should be marked as "winner". Currently not implemented in live version.
randomize_options:
type: boolean
example: false
description: For ranked choice votings, it might be useful to randomize the poll options list to remove a voting bias.
require_voter_names:
type: boolean
example: false
description: Participants will be required to enter their names. Often used in smaller groups when every personal opinion is relevant.
results_visibility:
type: string
enum:
- always
- after_deadline
- after_vote
- never
description: Changes the conditions of when participants are allowed to see the results.
use_custom_design:
type: boolean
example: false
description: Activates the use of custom design colors for a poll.
PollMeta:
type: object
properties:
description:
type: string
example: This is a description text.
description: A text field for the description of a poll.
location:
type: string
example: This is a location text.
description: A text field for the location of a poll or an related event.
vote_count:
type: integer
example: 969
readOnly: true
participant_count:
type: integer
example: 420
readOnly: true
view_count:
type: integer
example: 1337
readOnly: true
comment_count:
type: integer
example: 42
readOnly: true
creator_country:
type: string
example: de
readOnly: true
pin_code_expired_at:
type: integer
format: int64
readOnly: true
example: 1649671274
nullable: true
last_vote_at:
type: integer
format: int64
readOnly: true
example: 1649671274
nullable: true
timezone:
type: string
example: Europe/Berlin
nullable: true
PollResults:
type: object
properties:
id:
type: string
readOnly: true
example: NPgxkzPqrn2
version:
type: string
format: uuid
readOnly: true
voteCount:
type: integer
example: 1337
participantCount:
type: integer
example: 969
resultsKey:
type: string
format: uuid
description: The results key is used to fetch live data via Websocket.
poll_options:
type: array
items:
anyOf:
- $ref: '#/components/schemas/TextPollOption'
- $ref: '#/components/schemas/ImagePollOption'
- $ref: '#/components/schemas/DatePollOption'
- $ref: '#/components/schemas/TimeRangePollOption'
poll_participants:
type: array
items:
$ref: '#/components/schemas/PollParticipant'
PollParticipant:
type: object
properties:
id:
type: string
readOnly: true
example: NPgxkzPqrn2
name:
type: string
example: John Doe
country_code:
type: string
example: us
is_edit_allowed:
type: boolean
description: 'An indicator whether the current user is allowed to edit this entry. This should be done on client side, but well, here we are :)'
poll_votes:
type: array
items:
type: integer
nullable: true
example:
- 0
- 1
- 0
- null
description: 'This array indicates the votes corresponding to the array of poll_options. A value of 1 is a "yes" vote, a value of 0 is a "no" vote. In group polls, a value of null could indicate that the option was not present when the participant casted their vote.'
created_at:
type: integer
format: int64
readOnly: true
example: 1649671274
Media:
type: object
properties:
id:
type: string
example: poy9NPNwnJr
description: The ID of a Media object. When creating a poll with media, this is the only relevant field that is needed.
type:
type: string
example: image
enum:
- image
- video
- youtube
- giphy
user:
$ref: '#/components/schemas/PublicUser'
source:
type: string
example: 'https://www.example.com/source.html'
url:
type: string
example: 'https://cdn.strawpoll.com/media/poll-images/poy9NPNwnJr-c.png'
width:
type: integer
example: 640
height:
type: integer
example: 480
created_at:
type: integer
format: int64
readOnly: true
example: 1649671274
updated_at:
type: integer
format: int64
readOnly: true
example: 1649671274
PublicUser:
required:
- avatar_path
- displayname
type: object
properties:
id:
type: string
example: poy9NPNwnJr
username:
type: string
example: john-doe
displayname:
type: string
example: John Doe
avatar_path:
type: string
example: /images/avatars/john-doe-QrgewxGKypY.png
user_meta:
$ref: '#/components/schemas/UserMeta'
created_at:
type: integer
format: int64
example: 1649671274
readOnly: true
User:
allOf:
- $ref: '#/components/schemas/PublicUser'
- type: object
properties:
user_config:
$ref: '#/components/schemas/UserConfig'
UserMeta:
type: object
properties:
about:
type: string
example: A brief description for your public profile.
website:
type: string
example: 'https://www.example.com/'
country_code:
type: string
example: us
monthly_points:
type: integer
example: 42069
total_points:
type: integer
example: 69420
UserConfig:
type: object
properties:
appearance:
type: string
clock_type:
type: string
first_day_of_week:
type: integer
description: 'A value of 0 means Sunday, a value of 1 means Monday, etc.'
language: