-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathschema.graphql
1956 lines (1432 loc) · 40.7 KB
/
schema.graphql
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
schema {
subscription: RootSubscriptionType
mutation: RootMutationType
query: RootQueryType
}
interface Campaign {
"Campaign id"
id: Int!
"External ID (if set)"
externalId: Int
"Internal name of the campaign"
name: String!
"Full, official name of the campaign"
title: String!
"Schema for contact personal information"
contactSchema: ContactSchema!
"Custom config map"
config: Json!
"Statistics"
stats: CampaignStats!
"Lead org"
org: Org!
"""
Fetch public actions. Can be used to display recent comments for example.
To allow-list action fields to be public, `campaign.public_actions` must be set to a list of strings in form
action_type:custom_field_name, eg: `["signature:comment"]`. XXX this cannot be set in API, you need to set in backend.
"""
actions(
"Specify action type to return"
actionType: String!
"Limit the number of returned actions, default is 10, max is 100)"
limit: Int!
): PublicActionsResult!
"List MTT targets of this campaign"
targets: [Target]
}
type PublicCampaign implements Campaign {
"Campaign id"
id: Int!
"External ID (if set)"
externalId: Int
"Internal name of the campaign"
name: String!
"Full, official name of the campaign"
title: String!
"Schema for contact personal information"
contactSchema: ContactSchema!
"Custom config map"
config: Json!
"Statistics"
stats: CampaignStats!
"Lead org"
org: Org!
"""
Fetch public actions. Can be used to display recent comments for example.
To allow-list action fields to be public, `campaign.public_actions` must be set to a list of strings in form
action_type:custom_field_name, eg: `["signature:comment"]`. XXX this cannot be set in API, you need to set in backend.
"""
actions(
"Specify action type to return"
actionType: String!
"Limit the number of returned actions, default is 10, max is 100)"
limit: Int!
): PublicActionsResult!
"List MTT targets of this campaign"
targets: [Target]
}
"Tracking codes (UTM params)"
type Tracking {
source: String!
medium: String!
campaign: String!
content: String!
}
"GDPR consent data structure"
input ConsentInput {
"Has contact consented to receiving communication from widget owner? Null: not asked"
optIn: Boolean
"Opt in to the campaign leader"
leadOptIn: Boolean
}
type Donation {
schema: DonationSchema
"Provide amount of this donation, in smallest units for currency"
amount: Int!
"Provide currency of this donation"
currency: String!
"Donation data"
payload: Json!
"Donation frequency unit"
frequencyUnit: DonationFrequencyUnit!
}
type RootSubscriptionType {
actionPageUpserted(orgName: String): ActionPage!
}
type Confirm {
"Secret code\/PIN of the confirm"
code: String!
"Email the confirm is sent to"
email: String
"Message attached to the confirm"
message: String
"Object id that confirmable action refers to"
objectId: Int
"Who created the confirm"
creator: User
}
input SelectKey {
"Key id"
id: Int
"Only active"
active: Boolean
"Key having this public part"
public: String
}
interface ActionPage {
"Id"
id: Int!
"Locale for the widget, in i18n format"
locale: String!
"Name where the widget is hosted"
name: String!
"Thank you email templated of this Action Page"
thankYouTemplate: String
"A reference to thank you email template of this ActionPage"
thankYouTemplateRef: String
"Is live?"
live: Boolean!
"List of steps in journey"
journey: [String!]! @deprecated(reason: "moved under config")
"Config JSON of this action page"
config: Json!
"Campaign this action page belongs to."
campaign: Campaign!
"Org the action page belongs to"
org: Org!
}
type PrivateActionPage implements ActionPage {
"Id"
id: Int!
"Locale for the widget, in i18n format"
locale: String!
"Name where the widget is hosted"
name: String!
"Thank you email templated of this Action Page"
thankYouTemplate: String
"A reference to thank you email template of this ActionPage"
thankYouTemplateRef: String
"Is live?"
live: Boolean!
"List of steps in journey"
journey: [String!]! @deprecated(reason: "moved under config")
"Config JSON of this action page"
config: Json!
"Campaign this action page belongs to."
campaign: Campaign!
"Org the action page belongs to"
org: Org!
"Extra supporters, a number added to deduplicated supporter count. Cannot be added to per-area or per-action_type counts."
extraSupporters: Int!
"""
Action page collects also opt-out actions, to deliver them to authorities.
If false, the opt-outs will fallback to lead (we never trash data with opt-outs)
"""
delivery: Boolean!
"Email template to confirm supporter (DOI)"
supporterConfirmTemplate: String
"Location of the widget as last seen in HTTP REFERER header"
location: String
"Status of action page - STANDBY (ready to get actions), ACTIVE (collecting actions), STALLED (actions not coming any more)"
status: ActionPageStatus
}
type Service {
"Id"
id: Int!
"Service name (type)"
name: ServiceName!
"Hostname of service, but can be used as any \"container\" of the service. For AWS, contains a region."
host: String
"User, Account id, client id, whatever your API has"
user: String
"A sub-selector of a resource. Can be url path, but can be something like AWS bucket name"
path: String
}
"Count of actions for particular action type"
type AreaCount {
"area"
area: String!
"count of supporters in this area"
count: Int!
}
input StripeSubscriptionInput {
"Amount of payment"
amount: Int!
"Currency ofo payment"
currency: String!
"how often is recurrent payment made?"
frequencyUnit: DonationFrequencyUnit!
}
enum EmailStatus {
"An unused email. (Warning: Or used, but we do not store the fact that emails are delivered ok)"
NONE
"The user has received a DOI on this email and accepted it"
DOUBLE_OPT_IN
"This email was used and bounced"
BOUNCE
"This email was used and blocked"
BLOCKED
"This email was used and marked spam"
SPAM
"This email was used and user unsubscribed"
UNSUB
}
"Campaign statistics"
type CampaignStats {
"Unique action tagers count"
supporterCount: Int!
"Unique action takers by area"
supporterCountByArea: [AreaCount!]!
"Unique action takers by org"
supporterCountByOrg: [OrgCount!]!
"Unique supporter count not including the ones collected by org_name"
supporterCountByOthers(
"Org name to exclude from counting supporters"
orgName: String!
): Int!
"Action counts per action types (with duplicates)"
actionCount: [ActionTypeCount!]!
}
"Api token metadata"
type ApiToken {
expiresAt: NaiveDateTime!
}
"""
The `Naive DateTime` scalar type represents a naive date and time without
timezone. The DateTime appears in a JSON response as an ISO8601 formatted
string.
"""
scalar NaiveDateTime
type PublicActionPage implements ActionPage {
"Id"
id: Int!
"Locale for the widget, in i18n format"
locale: String!
"Name where the widget is hosted"
name: String!
"Thank you email templated of this Action Page"
thankYouTemplate: String
"A reference to thank you email template of this ActionPage"
thankYouTemplateRef: String
"Is live?"
live: Boolean!
"List of steps in journey"
journey: [String!]! @deprecated(reason: "moved under config")
"Config JSON of this action page"
config: Json!
"Campaign this action page belongs to."
campaign: Campaign!
"Org the action page belongs to"
org: Org!
}
"Count of supporters for particular org"
type OrgCount {
"org"
org: Org!
"count of supporters registered by org"
count: Int!
}
type DeleteUserResult {
status: Status!
}
"Encryption or sign key with integer id (database)"
type Key {
"Key id"
id: Int!
"Public part of the key (base64url)"
public: String!
"Name of the key (human readable)"
name: String!
"Is it active?"
active: Boolean!
"Is it expired?"
expired: Boolean!
"When the key was expired, in UTC"
expiredAt: NaiveDateTime
}
enum ServiceName {
"AWS SES to send emails"
SES
"AWS SQS to process messages"
SQS
"Mailjet to send emails"
MAILJET
"SMTP to send emails"
SMTP
"Wordpress HTTP API"
WORDPRESS
"Stripe to process donations"
STRIPE
"Stripe test account to test donations"
TEST_STRIPE
"HTTP POST webhook"
WEBHOOK
"Use a service that instance org is using"
SYSTEM
"Supabase to store files"
SUPABASE
}
type CampaignMtt {
"This is first day and start hour of the campaign. Note, every day of the campaign the start hour will be same."
startAt: DateTime!
"This is last day and end hour of the campaign. Note, every day of the campaign the end hour will be same."
endAt: DateTime!
"""
If email templates are used to create MTT, use this template (works like thank you email templates).
Otherwise, the raw text that is send with MTT action will make a plain text email.
"""
messageTemplate: String
"A test target email (yourself) where test mtt actions will be sent (instead to real targets)"
testEmail: String
}
input MttActionInput {
"Subject line"
subject: String
"Body"
body: String
"Target ids"
targets: [String!]!
"Files to attach (images allowed)"
files: [String!]
}
type Contact {
"Contact ref (fingerprint) of supporter"
contactRef: ID!
"Stringified json with PII optionally encrypted"
payload: String!
"Encryption nonce value"
nonce: String
"Public key used to encrypt this action"
publicKey: KeyIds
"Signing key used to encrypt this action"
signKey: KeyIds
}
input StripePaymentIntentInput {
"Amount of payment"
amount: Int!
"Currency ofo payment"
currency: String!
"Stripe payment method type"
paymentMethodTypes: [String!]
}
interface Target {
id: String!
"Name of target"
name: String!
"unique external_id of target, used to upsert target"
externalId: String!
"Locale of this target (in which language do they read emails?)"
locale: String
"Area of the target"
area: String
"Custom fields, stringified json"
fields: Json
}
type PublicTarget implements Target {
id: String!
"Name of target"
name: String!
"unique external_id of target, used to upsert target"
externalId: String!
"Locale of this target (in which language do they read emails?)"
locale: String
"Area of the target"
area: String
"Custom fields, stringified json"
fields: Json
}
enum Status {
"Operation completed succesfully"
SUCCESS
"Operation awaiting confirmation"
CONFIRMING
"Operation had no effect (already done)"
NOOP
}
type KeyIds {
"Key id"
id: Int!
"Public part of the key (base64url)"
public: String!
}
type User {
"Id of user"
id: Int!
"Email of user"
email: String!
"Phone"
phone: String
"Url to profile picture"
pictureUrl: String
"Job title"
jobTitle: String
"Users API token (to check expiry)"
apiToken: ApiToken
"Is user an admin?"
isAdmin: Boolean!
"user's roles in orgs"
roles: [UserRole!]!
}
enum Queue {
"Queue of thank you email sender worker"
EMAIL_SUPPORTER
"a custom queue of action that needs DOI"
CUSTOM_SUPPORTER_CONFIRM
"a custom queue of action that needs moderation"
CUSTOM_ACTION_CONFIRM
"a custom queue of actions to sync to CRM"
CUSTOM_ACTION_DELIVER
"Queue of SQS sync worker"
SQS
"Queue of webhook sync worker"
WEBHOOK
}
input SelectActionPage {
"Filter by campaign Id"
campaignId: Int
}
type UserRole {
"Org this role is in"
org: Org!
"Role name"
role: String!
}
type Partnership {
"Partner org"
org: Org!
"Partner's pages that are part of this campaign (can be more, eg: multiple languages)"
actionPages: [ActionPage!]!
"Join\/Launch requests of this partner"
launchRequests: [Confirm!]!
"The partner staffers who initiated a request"
launchRequesters: [User!]!
}
"""
The `Date` scalar type represents a date. The Date appears in a JSON
response as an ISO8601 formatted string, without a time component.
"""
scalar Date
type ConfirmResult {
"Status of Confirm: Success, Confirming (waiting for confirmation), Noop"
status: Status!
"Action page if its an object of confirm"
actionPage: ActionPage
"Campaign page if its an object of confirm"
campaign: Campaign
"Org if its an object of confirm"
org: Org
"A message attached to the confirm"
message: String
}
"Custom field added to action. For signature it can be contact, for mail it can be subject and body"
input ActionInput {
"Action Type"
actionType: String!
"Custom fields added to action"
customFields: Json
"Deprecated format: Other fields added to action"
fields: [CustomFieldInput!] @deprecated(reason: "use custom_fields")
"Donation payload"
donation: DonationActionInput
"MTT payload"
mtt: MttActionInput
"Test mode"
testing: Boolean
}
input UserDetailsInput {
"Users profile pic url"
pictureUrl: String
"Job title"
jobTitle: String
"Phone"
phone: String
}
type ActionCustomFields {
"id of action"
actionId: Int!
"type of action"
actionType: String!
"creation timestamp"
insertedAt: NaiveDateTime!
"area of supporter that did the action"
area: String
"custom fields as stringified json"
customFields: Json!
fields: [CustomField!]! @deprecated(reason: "use custom_fields")
}
type OrgUser {
email: String!
"Role in an org"
role: String!
"Date and time the user was created on this instance"
createdAt: NaiveDateTime!
"Date and time when user joined org"
joinedAt: NaiveDateTime!
"Will be removed"
lastSigninAt: NaiveDateTime
}
type RootQueryType {
"Returns a public list of campaigns, filtered by title. Can be used to implement a campaign search box on a website."
campaigns(
"Filter campaigns by title using LIKE format (% means any sequence of characters)"
title: String
"DEPRECATED: use campaign() to get one campaign. Filter campaigns by name (exact match). If found, returns list of 1 campaign, otherwise an empty list"
name: String
"DEPRECATED: use campaign() to get one campaign. Select by id, Returns list of 1 result"
id: Int
): [Campaign!]!
"""
Get one campaign. If you have access to the campaign, as lead or
partner, you will get a private view of the campaign, otherwise, a public
view.
"""
campaign(
"Get by id"
id: Int
"Get by name"
name: String
): Campaign
"""
Get action page.
Depending on your access (page owner, lead, instance admin),
you will get private or public view of the page.
"""
actionPage(
"Get action page by id."
id: Int
"Get action page by name the widget is displayed on"
name: String
"Get action page by url the widget is displayed on (DEPRECATED, use name)"
url: String
): ActionPage!
"Export actions collected by org, optionally filtered by campaign"
exportActions(
"Organization name"
orgName: String!
"Limit results to campaign name"
campaignName: String
"Limit results to campaign id"
campaignId: Int
"return only actions with id starting from this argument (inclusive)"
start: Int
"return only actions created at date time from this argument (inclusive)"
after: DateTime
"Limit the number of returned actions"
limit: Int
"Only download opted in contacts and actions (default true)"
onlyOptIn: Boolean
"Only download double opted in contacts"
onlyDoubleOptIn: Boolean
"Also include testing actions"
includeTesting: Boolean
): [Action]!
"Get the current user, as determined by Authorization header"
currentUser: User!
"Select users from this instnace. Requires a manage users admin permission."
users(
"Filter users"
select: SelectUser
): [User!]!
"Organization api (authenticated)"
org(
"Name of organisation"
name: String!
): PrivateOrg!
}
"""
The `DateTime` scalar type represents a date and time in the UTC
timezone. The DateTime appears in a JSON response as an ISO8601 formatted
string, including UTC timezone ("Z"). The parsed date and time string will
be converted to UTC if there is an offset.
"""
scalar DateTime
"Campaign content changed in mutations"
input CampaignInput {
"Campaign short name"
name: String
"Campaign external_id. If provided, it will be used to find campaign. Can be used to rename a campaign"
externalId: Int
"Campaign human readable title"
title: String
"Schema for contact personal information"
contactSchema: ContactSchema
"Custom config as stringified JSON map"
config: Json
"Action pages of this campaign"
actionPages: [ActionPageInput!]
"MTT configuration"
mtt: CampaignMttInput
}
type PersonalData {
"Schema for contact personal information"
contactSchema: ContactSchema!
"Email opt in enabled"
supporterConfirm: Boolean!
"Email opt in template name"
supporterConfirmTemplate: String
"High data security enabled"
highSecurity: Boolean!
"Only send thank you emails to opt-ins"
doiThankYou: Boolean!
}
input SelectCampaign {
titleLike: String
orgName: String
}
interface Org {
"Organisation short name"
name: String!
"Organisation title (human readable name)"
title: String!
"config"
config: Json!
}
type ContactReference {
"Contact's reference"
contactRef: String!
"Contacts first name"
firstName: String
}
input DonationActionInput {
"Provide payload schema to validate, eg. stripe_payment_intent"
schema: DonationSchema
"Provide amount of this donation, in smallest units for currency"
amount: Int
"Provide currency of this donation"
currency: String
"How often is the recurring donation collected"
frequencyUnit: DonationFrequencyUnit
"Custom JSON data"
payload: Json!
}
"Custom field with a key and value. Both are strings."
input CustomFieldInput {
key: String!
value: String!
"Unused. To mark action_type\/key as transient, use campaign.transient_actions list"
transient: Boolean
}
type JoinOrgResult {
"Result of joining - succes or pending confirmation"
status: Status!
"Org that was joined"
org: Org!
}
input TargetEmailInput {
"Email of target"
email: String!
}
input NationalityInput {
"Nationality \/ issuer of id document"
country: String!
"Document type"
documentType: String
"Document serial id\/number"
documentNumber: String
}
input OrgUserInput {
"Email of user"
email: String!
"Role name of user in this org"
role: String!
}
type ChangeUserStatus {
status: Status!
}
"Criteria to filter users"
input SelectUser {
id: Int
"Use % as wildcard"
email: String
"Exact org name"
orgName: String
}
enum ContactSchema {
BASIC
POPULAR_INITIATIVE
ECI
IT_CI
}
input SelectService {
name: ServiceName
}
"Result of actions query"
type PublicActionsResult {
"Custom field keys which are public"
fieldKeys: [String!]
"List of actions custom fields"
list: [ActionCustomFields]
}
input GenKeyInput {
"Name of the key"
name: String!
}
input AddKeyInput {
"Name of the key"
name: String!
"Public part of the key (base64url)"
public: String!
}
scalar Json
type Action {
"Id of action"
actionId: Int!
"Timestamp of creation"
createdAt: NaiveDateTime!
"Action type"
actionType: String!
"supporter contact data"
contact: Contact!
"Action custom fields (as stringified JSON)"
customFields: Json!
"Deprecated, use customFields"
fields: [CustomField!]! @deprecated(reason: "use custom_fields")
"UTM codes"
tracking: Tracking
"Campaign this action was collected in"
campaign: Campaign!