@a1liu/solidarity-tech-api 0.1.6 → 0.1.7

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.
@@ -1,759 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const oas_1 = __importDefault(require("oas"));
7
- const core_1 = __importDefault(require("api/dist/core"));
8
- const openapi_json_1 = __importDefault(require("./openapi.json"));
9
- class SDK {
10
- constructor() {
11
- this.spec = oas_1.default.init(openapi_json_1.default);
12
- this.core = new core_1.default(this.spec, 'solidarity-tech/v1 (api/6.1.3)');
13
- }
14
- /**
15
- * Optionally configure various options that the SDK allows.
16
- *
17
- * @param config Object of supported SDK options and toggles.
18
- * @param config.timeout Override the default `fetch` request timeout of 30 seconds. This number
19
- * should be represented in milliseconds.
20
- */
21
- config(config) {
22
- this.core.setConfig(config);
23
- }
24
- /**
25
- * If the API you're using requires authentication you can supply the required credentials
26
- * through this method and the library will magically determine how they should be used
27
- * within your API request.
28
- *
29
- * With the exception of OpenID and MutualTLS, it supports all forms of authentication
30
- * supported by the OpenAPI specification.
31
- *
32
- * @example <caption>HTTP Basic auth</caption>
33
- * sdk.auth('username', 'password');
34
- *
35
- * @example <caption>Bearer tokens (HTTP or OAuth 2)</caption>
36
- * sdk.auth('myBearerToken');
37
- *
38
- * @example <caption>API Keys</caption>
39
- * sdk.auth('myApiKey');
40
- *
41
- * @see {@link https://spec.openapis.org/oas/v3.0.3#fixed-fields-22}
42
- * @see {@link https://spec.openapis.org/oas/v3.1.0#fixed-fields-22}
43
- * @param values Your auth credentials for the API; can specify up to two strings or numbers.
44
- */
45
- auth(...values) {
46
- this.core.setAuth(...values);
47
- return this;
48
- }
49
- /**
50
- * If the API you're using offers alternate server URLs, and server variables, you can tell
51
- * the SDK which one to use with this method. To use it you can supply either one of the
52
- * server URLs that are contained within the OpenAPI definition (along with any server
53
- * variables), or you can pass it a fully qualified URL to use (that may or may not exist
54
- * within the OpenAPI definition).
55
- *
56
- * @example <caption>Server URL with server variables</caption>
57
- * sdk.server('https://{region}.api.example.com/{basePath}', {
58
- * name: 'eu',
59
- * basePath: 'v14',
60
- * });
61
- *
62
- * @example <caption>Fully qualified server URL</caption>
63
- * sdk.server('https://eu.api.example.com/v14');
64
- *
65
- * @param url Server URL
66
- * @param variables An object of variables to replace into the server URL.
67
- */
68
- server(url, variables = {}) {
69
- this.core.setServer(url, variables);
70
- }
71
- /**
72
- * Retrieves all activities
73
- *
74
- */
75
- getActivities(metadata) {
76
- return this.core.fetch('/activities', 'get', metadata);
77
- }
78
- /**
79
- * Lists agent assignments
80
- *
81
- */
82
- getAgent_assignments(metadata) {
83
- return this.core.fetch('/agent_assignments', 'get', metadata);
84
- }
85
- /**
86
- * Creates an agent assignment with the specified details.
87
- *
88
- * @summary Creates an agent assignment
89
- */
90
- postAgent_assignments(body) {
91
- return this.core.fetch('/agent_assignments', 'post', body);
92
- }
93
- /**
94
- * Shows a single agent assignment
95
- *
96
- */
97
- getAgent_assignmentsId(metadata) {
98
- return this.core.fetch('/agent_assignments/{id}', 'get', metadata);
99
- }
100
- /**
101
- * Updates an agent assignment with the specified details.
102
- *
103
- * @summary Updates an agent assignment
104
- */
105
- putAgent_assignmentsId(body, metadata) {
106
- return this.core.fetch('/agent_assignments/{id}', 'put', body, metadata);
107
- }
108
- /**
109
- * Deletes an agent assignment with the specified ID.
110
- *
111
- * @summary Deletes an agent assignment
112
- */
113
- deleteAgent_assignmentsId(metadata) {
114
- return this.core.fetch('/agent_assignments/{id}', 'delete', metadata);
115
- }
116
- /**
117
- * Enroll user in an automation
118
- *
119
- */
120
- postAutomation_enrollments(body) {
121
- return this.core.fetch('/automation_enrollments', 'post', body);
122
- }
123
- /**
124
- * Retrieves all calls
125
- *
126
- */
127
- getCalls(metadata) {
128
- return this.core.fetch('/calls', 'get', metadata);
129
- }
130
- /**
131
- * Lists chapter phone numbers
132
- *
133
- */
134
- getChapter_phone_numbers(metadata) {
135
- return this.core.fetch('/chapter_phone_numbers', 'get', metadata);
136
- }
137
- /**
138
- * Retrieves all chapters
139
- *
140
- */
141
- getChapters(metadata) {
142
- return this.core.fetch('/chapters', 'get', metadata);
143
- }
144
- /**
145
- * Retrieves all custom user properties
146
- *
147
- */
148
- getCustom_user_properties(metadata) {
149
- return this.core.fetch('/custom_user_properties', 'get', metadata);
150
- }
151
- /**
152
- * Creates a new custom user property
153
- *
154
- * @throws FetchError<422, types.PostCustomUserPropertiesResponse422> validation failed
155
- */
156
- postCustom_user_properties(body) {
157
- return this.core.fetch('/custom_user_properties', 'post', body);
158
- }
159
- /**
160
- * Removes an option from a custom user property
161
- *
162
- * @throws FetchError<404, types.DeleteCustomUserPropertiesCustomUserPropertyIdOptionsIdResponse404> option or custom user property not found
163
- * @throws FetchError<422, types.DeleteCustomUserPropertiesCustomUserPropertyIdOptionsIdResponse422> validation failed
164
- */
165
- deleteCustom_user_propertiesCustom_user_property_idOptionsId(metadata) {
166
- return this.core.fetch('/custom_user_properties/{custom_user_property_id}/options/{id}', 'delete', metadata);
167
- }
168
- /**
169
- * Creates an option for a custom user property
170
- *
171
- * @throws FetchError<404, types.PostCustomUserPropertiesIdOptionsResponse404> custom user property not found
172
- * @throws FetchError<422, types.PostCustomUserPropertiesIdOptionsResponse422> validation failed
173
- */
174
- postCustom_user_propertiesIdOptions(body, metadata) {
175
- return this.core.fetch('/custom_user_properties/{id}/options', 'post', body, metadata);
176
- }
177
- /**
178
- * Lists donation charges
179
- *
180
- */
181
- getDonation_charges(metadata) {
182
- return this.core.fetch('/donation_charges', 'get', metadata);
183
- }
184
- /**
185
- * Retrieves a donation charge
186
- *
187
- */
188
- getDonation_chargesId(metadata) {
189
- return this.core.fetch('/donation_charges/{id}', 'get', metadata);
190
- }
191
- /**
192
- * Lists email blasts
193
- *
194
- */
195
- getEmail_blasts(metadata) {
196
- return this.core.fetch('/email_blasts', 'get', metadata);
197
- }
198
- /**
199
- * Shows a single email blast
200
- *
201
- */
202
- getEmail_blastsId(metadata) {
203
- return this.core.fetch('/email_blasts/{id}', 'get', metadata);
204
- }
205
- /**
206
- * Returns a list of email senders available for the API key's scope. Use these sender IDs
207
- * when sending emails via the POST /emails endpoint.
208
- *
209
- * @summary Lists available email senders
210
- */
211
- getEmail_senders(metadata) {
212
- return this.core.fetch('/email_senders', 'get', metadata);
213
- }
214
- /**
215
- * Sends a single transactional email to a user. Supports Liquid templating for
216
- * personalization (e.g., {{ first_name }}).
217
- *
218
- * @summary Sends a one-off email to a user
219
- */
220
- postEmails(metadata) {
221
- return this.core.fetch('/emails', 'post', metadata);
222
- }
223
- /**
224
- * Lists event attendances
225
- *
226
- */
227
- getEvent_attendances(metadata) {
228
- return this.core.fetch('/event_attendances', 'get', metadata);
229
- }
230
- /**
231
- * Creates an event attendance with the specified details.
232
- *
233
- * @summary Creates an event attendance
234
- */
235
- postEvent_attendances(body) {
236
- return this.core.fetch('/event_attendances', 'post', body);
237
- }
238
- /**
239
- * Deletes an event attendance with the specified ID.
240
- *
241
- * @summary Deletes an event attendance
242
- */
243
- deleteEvent_attendancesId(metadata) {
244
- return this.core.fetch('/event_attendances/{id}', 'delete', metadata);
245
- }
246
- /**
247
- * Lists event rsvps
248
- *
249
- */
250
- getEvent_rsvps(metadata) {
251
- return this.core.fetch('/event_rsvps', 'get', metadata);
252
- }
253
- /**
254
- * Creates an event rsvp with the specified details.
255
- *
256
- * @summary Creates an event rsvp
257
- */
258
- postEvent_rsvps(body) {
259
- return this.core.fetch('/event_rsvps', 'post', body);
260
- }
261
- /**
262
- * Shows a single event rsvp
263
- *
264
- */
265
- getEvent_rsvpsId(metadata) {
266
- return this.core.fetch('/event_rsvps/{id}', 'get', metadata);
267
- }
268
- /**
269
- * Updates an event rsvp with the specified details.
270
- *
271
- * @summary Updates an event rsvp
272
- */
273
- putEvent_rsvpsId(body, metadata) {
274
- return this.core.fetch('/event_rsvps/{id}', 'put', body, metadata);
275
- }
276
- /**
277
- * Deletes an event rsvp with the specified ID.
278
- *
279
- * @summary Deletes an event rsvp
280
- */
281
- deleteEvent_rsvpsId(metadata) {
282
- return this.core.fetch('/event_rsvps/{id}', 'delete', metadata);
283
- }
284
- /**
285
- * Lists event sessions
286
- *
287
- */
288
- getEvent_sessions(metadata) {
289
- return this.core.fetch('/event_sessions', 'get', metadata);
290
- }
291
- /**
292
- * Creates an event session with the specified details.
293
- *
294
- * @summary Creates an event session
295
- */
296
- postEvent_sessions(body) {
297
- return this.core.fetch('/event_sessions', 'post', body);
298
- }
299
- /**
300
- * Shows a single event session
301
- *
302
- */
303
- getEvent_sessionsId(metadata) {
304
- return this.core.fetch('/event_sessions/{id}', 'get', metadata);
305
- }
306
- /**
307
- * Updates an event session with the specified details.
308
- *
309
- * @summary Updates an event session
310
- */
311
- putEvent_sessionsId(body, metadata) {
312
- return this.core.fetch('/event_sessions/{id}', 'put', body, metadata);
313
- }
314
- /**
315
- * Deletes an event session with the specified ID.
316
- *
317
- * @summary Deletes an event session
318
- */
319
- deleteEvent_sessionsId(metadata) {
320
- return this.core.fetch('/event_sessions/{id}', 'delete', metadata);
321
- }
322
- /**
323
- * Lists events accessible within the given scope. Each event in the response includes
324
- * `primary_event_id` and `is_co_hosted_mirror`. For co-hosted events that appear across
325
- * multiple organizations, `primary_event_id` always resolves to the original event ID,
326
- * allowing you to identify that two events from different scopes represent the same real
327
- * world event. Each event session also includes `primary_session_id` for the same purpose.
328
- * Events with an event page also include `image_url` and `description` fields.
329
- *
330
- * @summary Lists events
331
- */
332
- getEvents(metadata) {
333
- return this.core.fetch('/events', 'get', metadata);
334
- }
335
- /**
336
- * Creates an event with its first event session. The event session inherits the title from
337
- * the event unless session_title is provided.
338
- *
339
- * @summary Creates an event
340
- */
341
- postEvents(body) {
342
- return this.core.fetch('/events', 'post', body);
343
- }
344
- /**
345
- * Returns a single event. The response includes `primary_event_id` (always resolves to the
346
- * original event ID, even for co-hosted mirrors) and `is_co_hosted_mirror` (true if this
347
- * event is a mirror copy from a co-host relationship). Event sessions include
348
- * `primary_session_id` for the same purpose. If the event has an event page, the response
349
- * also includes `image_url` (the event page image) and `description` (plain text content
350
- * from the event page). Both fields are null when no event page exists.
351
- *
352
- * @summary Shows a single event
353
- */
354
- getEventsId(metadata) {
355
- return this.core.fetch('/events/{id}', 'get', metadata);
356
- }
357
- /**
358
- * Generates a field survey URL
359
- *
360
- */
361
- postField_survey_urls(body) {
362
- return this.core.fetch('/field_survey_urls', 'post', body);
363
- }
364
- /**
365
- * Lists organizations
366
- *
367
- */
368
- getOrganizations(metadata) {
369
- return this.core.fetch('/organizations', 'get', metadata);
370
- }
371
- /**
372
- * Shows a single organization
373
- *
374
- */
375
- getOrganizationsId(metadata) {
376
- return this.core.fetch('/organizations/{id}', 'get', metadata);
377
- }
378
- /**
379
- * Lists pages
380
- *
381
- */
382
- getPages(metadata) {
383
- return this.core.fetch('/pages', 'get', metadata);
384
- }
385
- /**
386
- * Shows a single page
387
- *
388
- */
389
- getPagesId(metadata) {
390
- return this.core.fetch('/pages/{id}', 'get', metadata);
391
- }
392
- /**
393
- * Lists phonebanks
394
- *
395
- */
396
- getPhonebanks(metadata) {
397
- return this.core.fetch('/phonebanks', 'get', metadata);
398
- }
399
- /**
400
- * Shows a single phonebank
401
- *
402
- */
403
- getPhonebanksId(metadata) {
404
- return this.core.fetch('/phonebanks/{id}', 'get', metadata);
405
- }
406
- /**
407
- * Lists scheduled calls
408
- *
409
- */
410
- getScheduled_calls(metadata) {
411
- return this.core.fetch('/scheduled_calls', 'get', metadata);
412
- }
413
- /**
414
- * Shows a single scheduled call
415
- *
416
- */
417
- getScheduled_callsId(metadata) {
418
- return this.core.fetch('/scheduled_calls/{id}', 'get', metadata);
419
- }
420
- /**
421
- * Lists scheduled tasks
422
- *
423
- */
424
- getScheduled_tasks(metadata) {
425
- return this.core.fetch('/scheduled_tasks', 'get', metadata);
426
- }
427
- /**
428
- * Creates an scheduled task with the specified details.
429
- *
430
- * @summary Creates an scheduled task
431
- */
432
- postScheduled_tasks(body) {
433
- return this.core.fetch('/scheduled_tasks', 'post', body);
434
- }
435
- /**
436
- * Shows a single scheduled task
437
- *
438
- */
439
- getScheduled_tasksId(metadata) {
440
- return this.core.fetch('/scheduled_tasks/{id}', 'get', metadata);
441
- }
442
- /**
443
- * Updates an scheduled task with the specified details.
444
- *
445
- * @summary Updates an scheduled task
446
- */
447
- putScheduled_tasksId(body, metadata) {
448
- return this.core.fetch('/scheduled_tasks/{id}', 'put', body, metadata);
449
- }
450
- /**
451
- * Deletes an scheduled task with the specified ID.
452
- *
453
- * @summary Deletes an scheduled task
454
- */
455
- deleteScheduled_tasksId(metadata) {
456
- return this.core.fetch('/scheduled_tasks/{id}', 'delete', metadata);
457
- }
458
- /**
459
- * Lists task agents
460
- *
461
- */
462
- getTask_agents(metadata) {
463
- return this.core.fetch('/task_agents', 'get', metadata);
464
- }
465
- /**
466
- * Creates an task agent with the specified details.
467
- *
468
- * @summary Creates an task agent
469
- */
470
- postTask_agents(body) {
471
- return this.core.fetch('/task_agents', 'post', body);
472
- }
473
- /**
474
- * Shows a single task agent
475
- *
476
- */
477
- getTask_agentsId(metadata) {
478
- return this.core.fetch('/task_agents/{id}', 'get', metadata);
479
- }
480
- /**
481
- * Deletes an task agent with the specified ID.
482
- *
483
- * @summary Deletes an task agent
484
- */
485
- deleteTask_agentsId(metadata) {
486
- return this.core.fetch('/task_agents/{id}', 'delete', metadata);
487
- }
488
- /**
489
- * Lists task assignments
490
- *
491
- */
492
- getTask_assignments(metadata) {
493
- return this.core.fetch('/task_assignments', 'get', metadata);
494
- }
495
- /**
496
- * Creates a task assignment, assigning a user to participate in a phonebank or textbank
497
- * campaign.
498
- *
499
- * @summary Creates a task assignment
500
- */
501
- postTask_assignments(body) {
502
- return this.core.fetch('/task_assignments', 'post', body);
503
- }
504
- /**
505
- * Shows a single task assignment
506
- *
507
- */
508
- getTask_assignmentsId(metadata) {
509
- return this.core.fetch('/task_assignments/{id}', 'get', metadata);
510
- }
511
- /**
512
- * Updates an task assignment with the specified details.
513
- *
514
- * @summary Updates an task assignment
515
- */
516
- putTask_assignmentsId(body, metadata) {
517
- return this.core.fetch('/task_assignments/{id}', 'put', body, metadata);
518
- }
519
- /**
520
- * Deletes an task assignment with the specified ID.
521
- *
522
- * @summary Deletes an task assignment
523
- */
524
- deleteTask_assignmentsId(metadata) {
525
- return this.core.fetch('/task_assignments/{id}', 'delete', metadata);
526
- }
527
- /**
528
- * Lists team members
529
- *
530
- */
531
- getTeam_members(metadata) {
532
- return this.core.fetch('/team_members', 'get', metadata);
533
- }
534
- /**
535
- * Creates a new team member
536
- *
537
- */
538
- postTeam_members(body) {
539
- return this.core.fetch('/team_members', 'post', body);
540
- }
541
- /**
542
- * Updates a team member
543
- *
544
- */
545
- putTeam_membersId(body, metadata) {
546
- return this.core.fetch('/team_members/{id}', 'put', body, metadata);
547
- }
548
- /**
549
- * Lists text blasts
550
- *
551
- */
552
- getText_blasts(metadata) {
553
- return this.core.fetch('/text_blasts', 'get', metadata);
554
- }
555
- /**
556
- * Shows a single text blast
557
- *
558
- */
559
- getText_blastsId(metadata) {
560
- return this.core.fetch('/text_blasts/{id}', 'get', metadata);
561
- }
562
- /**
563
- * Lists text templates
564
- *
565
- */
566
- getText_templates(metadata) {
567
- return this.core.fetch('/text_templates', 'get', metadata);
568
- }
569
- /**
570
- * Creates an text template with the specified details.
571
- *
572
- * @summary Creates an text template
573
- */
574
- postText_templates(body) {
575
- return this.core.fetch('/text_templates', 'post', body);
576
- }
577
- /**
578
- * Shows a single text template
579
- *
580
- */
581
- getText_templatesId(metadata) {
582
- return this.core.fetch('/text_templates/{id}', 'get', metadata);
583
- }
584
- /**
585
- * Updates an text template with the specified details.
586
- *
587
- * @summary Updates an text template
588
- */
589
- putText_templatesId(body, metadata) {
590
- return this.core.fetch('/text_templates/{id}', 'put', body, metadata);
591
- }
592
- /**
593
- * Deletes an text template with the specified ID.
594
- *
595
- * @summary Deletes an text template
596
- */
597
- deleteText_templatesId(metadata) {
598
- return this.core.fetch('/text_templates/{id}', 'delete', metadata);
599
- }
600
- /**
601
- * Lists textbanks
602
- *
603
- */
604
- getTextbanks(metadata) {
605
- return this.core.fetch('/textbanks', 'get', metadata);
606
- }
607
- /**
608
- * Shows a single textbank
609
- *
610
- */
611
- getTextbanksId(metadata) {
612
- return this.core.fetch('/textbanks/{id}', 'get', metadata);
613
- }
614
- /**
615
- * Sends a text message
616
- *
617
- */
618
- postTexts(metadata) {
619
- return this.core.fetch('/texts', 'post', metadata);
620
- }
621
- /**
622
- * Retrieves a list of texts
623
- *
624
- */
625
- getTexts(metadata) {
626
- return this.core.fetch('/texts', 'get', metadata);
627
- }
628
- /**
629
- * Lists user actions (form submissions). Can be filtered by user_id, page_id, or both. To
630
- * get custom form responses for event RSVPs, first get the event's event_page_id from GET
631
- * /events/{id}, then query this endpoint with that page_id. Match to RSVPs by user_id.
632
- *
633
- * @summary Retrieves user actions
634
- */
635
- getUser_actions(metadata) {
636
- return this.core.fetch('/user_actions', 'get', metadata);
637
- }
638
- /**
639
- * Creates a user action for a user. Note: This endpoint cannot be used for creating
640
- * actions related to donation pages or scheduled call pages.
641
- *
642
- * @summary Creates a user action
643
- */
644
- postUser_actions(body) {
645
- return this.core.fetch('/user_actions', 'post', body);
646
- }
647
- /**
648
- * Lists user lists
649
- *
650
- */
651
- getUser_lists(metadata) {
652
- return this.core.fetch('/user_lists', 'get', metadata);
653
- }
654
- /**
655
- * Creates a User List with the specified details. The parameters field must conform to the
656
- * QueryBuilder format.
657
- *
658
- * @summary Creates a user list
659
- */
660
- postUser_lists(body) {
661
- return this.core.fetch('/user_lists', 'post', body);
662
- }
663
- /**
664
- * Shows a single user list
665
- *
666
- */
667
- getUser_listsId(metadata) {
668
- return this.core.fetch('/user_lists/{id}', 'get', metadata);
669
- }
670
- /**
671
- * Updates a user list with the specified details.
672
- *
673
- * @summary Updates a user list
674
- */
675
- putUser_listsId(body, metadata) {
676
- return this.core.fetch('/user_lists/{id}', 'put', body, metadata);
677
- }
678
- /**
679
- * Deletes a user list with the specified ID.
680
- *
681
- * @summary Deletes a user list
682
- */
683
- deleteUser_listsId(metadata) {
684
- return this.core.fetch('/user_lists/{id}', 'delete', metadata);
685
- }
686
- /**
687
- * Creates a user note
688
- *
689
- */
690
- postUser_notes(metadata) {
691
- return this.core.fetch('/user_notes', 'post', metadata);
692
- }
693
- /**
694
- * Deletes a user note with the specified ID.
695
- *
696
- * @summary Deletes a user note
697
- */
698
- deleteUser_notesId(metadata) {
699
- return this.core.fetch('/user_notes/{id}', 'delete', metadata);
700
- }
701
- /**
702
- * Lists available relationship types
703
- *
704
- */
705
- getUser_relationships(metadata) {
706
- return this.core.fetch('/user_relationships', 'get', metadata);
707
- }
708
- /**
709
- * Creates a user relationship
710
- *
711
- */
712
- postUser_relationships(metadata) {
713
- return this.core.fetch('/user_relationships', 'post', metadata);
714
- }
715
- /**
716
- * Deletes a user relationship
717
- *
718
- */
719
- deleteUser_relationshipsId(metadata) {
720
- return this.core.fetch('/user_relationships/{id}', 'delete', metadata);
721
- }
722
- /**
723
- * Creates or updates a user
724
- *
725
- */
726
- postUsers(body) {
727
- return this.core.fetch('/users', 'post', body);
728
- }
729
- /**
730
- * Retrieves a list of users
731
- *
732
- */
733
- getUsers(metadata) {
734
- return this.core.fetch('/users', 'get', metadata);
735
- }
736
- /**
737
- * Merge duplicate users
738
- *
739
- */
740
- postUsersMerge(body) {
741
- return this.core.fetch('/users/merge', 'post', body);
742
- }
743
- /**
744
- * Shows a single user
745
- *
746
- */
747
- getUsersId(metadata) {
748
- return this.core.fetch('/users/{id}', 'get', metadata);
749
- }
750
- /**
751
- * Updates a user
752
- *
753
- */
754
- putUsersId(body, metadata) {
755
- return this.core.fetch('/users/{id}', 'put', body, metadata);
756
- }
757
- }
758
- const createSDK = (() => { return new SDK(); })();
759
- exports.default = createSDK;