@a1liu/solidarity-tech-api 0.1.5 → 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.
@@ -0,0 +1,369 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.listActivities = listActivities;
4
+ exports.listAgentAssignments = listAgentAssignments;
5
+ exports.createAgentAssignment = createAgentAssignment;
6
+ exports.getAgentAssignment = getAgentAssignment;
7
+ exports.updateAgentAssignment = updateAgentAssignment;
8
+ exports.deleteAgentAssignment = deleteAgentAssignment;
9
+ exports.listCalls = listCalls;
10
+ exports.listChapterPhoneNumbers = listChapterPhoneNumbers;
11
+ exports.listChapters = listChapters;
12
+ exports.listCustomUserProperties = listCustomUserProperties;
13
+ exports.listEmailBlasts = listEmailBlasts;
14
+ exports.getEmailBlast = getEmailBlast;
15
+ exports.listEventAttendances = listEventAttendances;
16
+ exports.createEventAttendance = createEventAttendance;
17
+ exports.listEventRsvps = listEventRsvps;
18
+ exports.createEventRsvp = createEventRsvp;
19
+ exports.getEventRsvp = getEventRsvp;
20
+ exports.updateEventRsvp = updateEventRsvp;
21
+ exports.deleteEventRsvp = deleteEventRsvp;
22
+ exports.listEventSessions = listEventSessions;
23
+ exports.createEventSession = createEventSession;
24
+ exports.getEventSession = getEventSession;
25
+ exports.updateEventSession = updateEventSession;
26
+ exports.deleteEventSession = deleteEventSession;
27
+ exports.listEvents = listEvents;
28
+ exports.getEvent = getEvent;
29
+ exports.listOrganizations = listOrganizations;
30
+ exports.getOrganization = getOrganization;
31
+ exports.listPages = listPages;
32
+ exports.getPage = getPage;
33
+ exports.listPhonebanks = listPhonebanks;
34
+ exports.getPhonebank = getPhonebank;
35
+ exports.listScheduledCalls = listScheduledCalls;
36
+ exports.getScheduledCall = getScheduledCall;
37
+ exports.listScheduledTasks = listScheduledTasks;
38
+ exports.createScheduledTask = createScheduledTask;
39
+ exports.getScheduledTask = getScheduledTask;
40
+ exports.updateScheduledTask = updateScheduledTask;
41
+ exports.deleteScheduledTask = deleteScheduledTask;
42
+ exports.listTaskAgents = listTaskAgents;
43
+ exports.createTaskAgent = createTaskAgent;
44
+ exports.getTaskAgent = getTaskAgent;
45
+ exports.deleteTaskAgent = deleteTaskAgent;
46
+ exports.listTaskAssignments = listTaskAssignments;
47
+ exports.createTaskAssignment = createTaskAssignment;
48
+ exports.getTaskAssignment = getTaskAssignment;
49
+ exports.updateTaskAssignment = updateTaskAssignment;
50
+ exports.deleteTaskAssignment = deleteTaskAssignment;
51
+ exports.listTeamMembers = listTeamMembers;
52
+ exports.listTextBlasts = listTextBlasts;
53
+ exports.getTextBlast = getTextBlast;
54
+ exports.listTextTemplates = listTextTemplates;
55
+ exports.createTextTemplate = createTextTemplate;
56
+ exports.getTextTemplate = getTextTemplate;
57
+ exports.updateTextTemplate = updateTextTemplate;
58
+ exports.deleteTextTemplate = deleteTextTemplate;
59
+ exports.listTextbanks = listTextbanks;
60
+ exports.getTextbank = getTextbank;
61
+ exports.sendText = sendText;
62
+ exports.listTexts = listTexts;
63
+ exports.createUserAction = createUserAction;
64
+ exports.listUserLists = listUserLists;
65
+ exports.getUserList = getUserList;
66
+ exports.createUserNote = createUserNote;
67
+ exports.createUser = createUser;
68
+ exports.listUsers = listUsers;
69
+ exports.updateUser = updateUser;
70
+ const client_1 = require("./client");
71
+ const schemas_1 = require("./schemas");
72
+ /** GET /activities — Retrieves all activities. */
73
+ function listActivities(config, params = {}) {
74
+ return (0, client_1.apiGet)(config, "/activities", { query: Object.assign({}, params), schema: schemas_1.activitiesResponse });
75
+ }
76
+ /** GET /agent_assignments — Lists agent assignments. */
77
+ function listAgentAssignments(config, params = {}) {
78
+ return (0, client_1.apiGet)(config, "/agent_assignments", { query: Object.assign({}, params) });
79
+ }
80
+ /** POST /agent_assignments — Creates an agent assignment. */
81
+ function createAgentAssignment(config, body) {
82
+ return (0, client_1.apiPost)(config, "/agent_assignments", { body });
83
+ }
84
+ /** GET /agent_assignments/{id} — Shows a single agent assignment. */
85
+ function getAgentAssignment(config, id) {
86
+ return (0, client_1.apiGet)(config, `/agent_assignments/${id}`);
87
+ }
88
+ /** PUT /agent_assignments/{id} — Updates an agent assignment. */
89
+ function updateAgentAssignment(config, id, body) {
90
+ return (0, client_1.apiPut)(config, `/agent_assignments/${id}`, { body });
91
+ }
92
+ /** DELETE /agent_assignments/{id} — Deletes an agent assignment. */
93
+ function deleteAgentAssignment(config, id) {
94
+ return (0, client_1.apiDelete)(config, `/agent_assignments/${id}`);
95
+ }
96
+ /** GET /calls — Retrieves all calls. */
97
+ function listCalls(config, params = {}) {
98
+ return (0, client_1.apiGet)(config, "/calls", { query: Object.assign({}, params), schema: schemas_1.callsResponse });
99
+ }
100
+ /** GET /chapter_phone_numbers — Lists chapter phone numbers. */
101
+ function listChapterPhoneNumbers(config, params = {}) {
102
+ return (0, client_1.apiGet)(config, "/chapter_phone_numbers", { query: Object.assign({}, params) });
103
+ }
104
+ /* ------------------------------------------------------------------ *
105
+ * Chapters
106
+ * ------------------------------------------------------------------ */
107
+ /** GET /chapters — Retrieves all chapters. */
108
+ function listChapters(config, params = {}) {
109
+ return (0, client_1.apiGet)(config, "/chapters", { query: Object.assign({}, params), schema: schemas_1.chaptersResponse });
110
+ }
111
+ /* ------------------------------------------------------------------ *
112
+ * Custom User Properties
113
+ * ------------------------------------------------------------------ */
114
+ /** GET /custom_user_properties — Retrieves all custom user properties. */
115
+ function listCustomUserProperties(config, params = {}) {
116
+ return (0, client_1.apiGet)(config, "/custom_user_properties", {
117
+ query: Object.assign({}, params),
118
+ schema: schemas_1.customUserPropertiesResponse,
119
+ });
120
+ }
121
+ /* ------------------------------------------------------------------ *
122
+ * Email Blasts
123
+ * ------------------------------------------------------------------ */
124
+ /** GET /email_blasts — Lists email blasts. */
125
+ function listEmailBlasts(config, params = {}) {
126
+ return (0, client_1.apiGet)(config, "/email_blasts", { query: Object.assign({}, params) });
127
+ }
128
+ /** GET /email_blasts/{id} — Shows a single email blast. */
129
+ function getEmailBlast(config, id) {
130
+ return (0, client_1.apiGet)(config, `/email_blasts/${id}`);
131
+ }
132
+ /** GET /event_attendances — Lists event attendances. */
133
+ function listEventAttendances(config, params = {}) {
134
+ return (0, client_1.apiGet)(config, "/event_attendances", { query: Object.assign({}, params) });
135
+ }
136
+ /** POST /event_attendances — Creates an event attendance. */
137
+ function createEventAttendance(config, body) {
138
+ return (0, client_1.apiPost)(config, "/event_attendances", { body });
139
+ }
140
+ /** GET /event_rsvps — Lists event rsvps. */
141
+ function listEventRsvps(config, params = {}) {
142
+ return (0, client_1.apiGet)(config, "/event_rsvps", { query: Object.assign({}, params) });
143
+ }
144
+ /** POST /event_rsvps — Creates an event rsvp. */
145
+ function createEventRsvp(config, body) {
146
+ return (0, client_1.apiPost)(config, "/event_rsvps", { body });
147
+ }
148
+ /** GET /event_rsvps/{id} — Shows a single event rsvp. */
149
+ function getEventRsvp(config, id) {
150
+ return (0, client_1.apiGet)(config, `/event_rsvps/${id}`);
151
+ }
152
+ /** PUT /event_rsvps/{id} — Updates an event rsvp. */
153
+ function updateEventRsvp(config, id, body) {
154
+ return (0, client_1.apiPut)(config, `/event_rsvps/${id}`, { body });
155
+ }
156
+ /** DELETE /event_rsvps/{id} — Deletes an event rsvp. */
157
+ function deleteEventRsvp(config, id) {
158
+ return (0, client_1.apiDelete)(config, `/event_rsvps/${id}`);
159
+ }
160
+ /** GET /event_sessions — Lists event sessions. */
161
+ function listEventSessions(config, params = {}) {
162
+ return (0, client_1.apiGet)(config, "/event_sessions", { query: Object.assign({}, params) });
163
+ }
164
+ /** POST /event_sessions — Creates an event session. */
165
+ function createEventSession(config, body) {
166
+ return (0, client_1.apiPost)(config, "/event_sessions", { body });
167
+ }
168
+ /** GET /event_sessions/{id} — Shows a single event session. */
169
+ function getEventSession(config, id) {
170
+ return (0, client_1.apiGet)(config, `/event_sessions/${id}`);
171
+ }
172
+ /** PUT /event_sessions/{id} — Updates an event session. */
173
+ function updateEventSession(config, id, body) {
174
+ return (0, client_1.apiPut)(config, `/event_sessions/${id}`, { body });
175
+ }
176
+ /** DELETE /event_sessions/{id} — Deletes an event session. */
177
+ function deleteEventSession(config, id) {
178
+ return (0, client_1.apiDelete)(config, `/event_sessions/${id}`);
179
+ }
180
+ /* ------------------------------------------------------------------ *
181
+ * Events
182
+ * ------------------------------------------------------------------ */
183
+ /** GET /events — Lists events. */
184
+ function listEvents(config, params = {}) {
185
+ return (0, client_1.apiGet)(config, "/events", { query: Object.assign({}, params) });
186
+ }
187
+ /** GET /events/{id} — Shows a single event. */
188
+ function getEvent(config, id) {
189
+ return (0, client_1.apiGet)(config, `/events/${id}`);
190
+ }
191
+ /* ------------------------------------------------------------------ *
192
+ * Organizations
193
+ * ------------------------------------------------------------------ */
194
+ /** GET /organizations — Lists organizations. */
195
+ function listOrganizations(config, params = {}) {
196
+ return (0, client_1.apiGet)(config, "/organizations", { query: Object.assign({}, params) });
197
+ }
198
+ /** GET /organizations/{id} — Shows a single organization. */
199
+ function getOrganization(config, id) {
200
+ return (0, client_1.apiGet)(config, `/organizations/${id}`);
201
+ }
202
+ /* ------------------------------------------------------------------ *
203
+ * Pages
204
+ * ------------------------------------------------------------------ */
205
+ /** GET /pages — Lists pages. */
206
+ function listPages(config, params = {}) {
207
+ return (0, client_1.apiGet)(config, "/pages", { query: Object.assign({}, params) });
208
+ }
209
+ /** GET /pages/{id} — Shows a single page. */
210
+ function getPage(config, id) {
211
+ return (0, client_1.apiGet)(config, `/pages/${id}`);
212
+ }
213
+ /** GET /phonebanks — Lists phonebanks. */
214
+ function listPhonebanks(config, params = {}) {
215
+ return (0, client_1.apiGet)(config, "/phonebanks", { query: Object.assign({}, params) });
216
+ }
217
+ /** GET /phonebanks/{id} — Shows a single phonebank. */
218
+ function getPhonebank(config, id) {
219
+ return (0, client_1.apiGet)(config, `/phonebanks/${id}`);
220
+ }
221
+ /** GET /scheduled_calls — Lists scheduled calls. */
222
+ function listScheduledCalls(config, params = {}) {
223
+ return (0, client_1.apiGet)(config, "/scheduled_calls", { query: Object.assign({}, params) });
224
+ }
225
+ /** GET /scheduled_calls/{id} — Shows a single scheduled call. */
226
+ function getScheduledCall(config, id) {
227
+ return (0, client_1.apiGet)(config, `/scheduled_calls/${id}`);
228
+ }
229
+ /** GET /scheduled_tasks — Lists scheduled tasks. */
230
+ function listScheduledTasks(config, params = {}) {
231
+ return (0, client_1.apiGet)(config, "/scheduled_tasks", { query: Object.assign({}, params) });
232
+ }
233
+ /** POST /scheduled_tasks — Creates a scheduled task. */
234
+ function createScheduledTask(config, body) {
235
+ return (0, client_1.apiPost)(config, "/scheduled_tasks", { body });
236
+ }
237
+ /** GET /scheduled_tasks/{id} — Shows a single scheduled task. */
238
+ function getScheduledTask(config, id) {
239
+ return (0, client_1.apiGet)(config, `/scheduled_tasks/${id}`);
240
+ }
241
+ /** PUT /scheduled_tasks/{id} — Updates a scheduled task. */
242
+ function updateScheduledTask(config, id, body) {
243
+ return (0, client_1.apiPut)(config, `/scheduled_tasks/${id}`, { body });
244
+ }
245
+ /** DELETE /scheduled_tasks/{id} — Deletes a scheduled task. */
246
+ function deleteScheduledTask(config, id) {
247
+ return (0, client_1.apiDelete)(config, `/scheduled_tasks/${id}`);
248
+ }
249
+ /** GET /task_agents — Lists task agents. */
250
+ function listTaskAgents(config, params = {}) {
251
+ return (0, client_1.apiGet)(config, "/task_agents", { query: Object.assign({}, params) });
252
+ }
253
+ /** POST /task_agents — Creates a task agent. */
254
+ function createTaskAgent(config, body) {
255
+ return (0, client_1.apiPost)(config, "/task_agents", { body });
256
+ }
257
+ /** GET /task_agents/{id} — Shows a single task agent. */
258
+ function getTaskAgent(config, id) {
259
+ return (0, client_1.apiGet)(config, `/task_agents/${id}`);
260
+ }
261
+ /** DELETE /task_agents/{id} — Deletes a task agent. */
262
+ function deleteTaskAgent(config, id) {
263
+ return (0, client_1.apiDelete)(config, `/task_agents/${id}`);
264
+ }
265
+ /** GET /task_assignments — Lists task assignments. */
266
+ function listTaskAssignments(config, params = {}) {
267
+ return (0, client_1.apiGet)(config, "/task_assignments", { query: Object.assign({}, params) });
268
+ }
269
+ /** POST /task_assignments — Creates a task assignment. */
270
+ function createTaskAssignment(config, body) {
271
+ return (0, client_1.apiPost)(config, "/task_assignments", { body });
272
+ }
273
+ /** GET /task_assignments/{id} — Shows a single task assignment. */
274
+ function getTaskAssignment(config, id) {
275
+ return (0, client_1.apiGet)(config, `/task_assignments/${id}`);
276
+ }
277
+ /** PUT /task_assignments/{id} — Updates a task assignment. */
278
+ function updateTaskAssignment(config, id, body) {
279
+ return (0, client_1.apiPut)(config, `/task_assignments/${id}`, { body });
280
+ }
281
+ /** DELETE /task_assignments/{id} — Deletes a task assignment. */
282
+ function deleteTaskAssignment(config, id) {
283
+ return (0, client_1.apiDelete)(config, `/task_assignments/${id}`);
284
+ }
285
+ /* ------------------------------------------------------------------ *
286
+ * Team Members
287
+ * ------------------------------------------------------------------ */
288
+ /** GET /team_members — Lists team members. */
289
+ function listTeamMembers(config, params = {}) {
290
+ return (0, client_1.apiGet)(config, "/team_members", { query: Object.assign({}, params) });
291
+ }
292
+ /* ------------------------------------------------------------------ *
293
+ * Text Blasts
294
+ * ------------------------------------------------------------------ */
295
+ /** GET /text_blasts — Lists text blasts. */
296
+ function listTextBlasts(config, params = {}) {
297
+ return (0, client_1.apiGet)(config, "/text_blasts", { query: Object.assign({}, params) });
298
+ }
299
+ /** GET /text_blasts/{id} — Shows a single text blast. */
300
+ function getTextBlast(config, id) {
301
+ return (0, client_1.apiGet)(config, `/text_blasts/${id}`);
302
+ }
303
+ /** GET /text_templates — Lists text templates. */
304
+ function listTextTemplates(config, params = {}) {
305
+ return (0, client_1.apiGet)(config, "/text_templates", { query: Object.assign({}, params) });
306
+ }
307
+ /** POST /text_templates — Creates a text template. */
308
+ function createTextTemplate(config, body) {
309
+ return (0, client_1.apiPost)(config, "/text_templates", { body });
310
+ }
311
+ /** GET /text_templates/{id} — Shows a single text template. */
312
+ function getTextTemplate(config, id) {
313
+ return (0, client_1.apiGet)(config, `/text_templates/${id}`);
314
+ }
315
+ /** PUT /text_templates/{id} — Updates a text template. */
316
+ function updateTextTemplate(config, id, body) {
317
+ return (0, client_1.apiPut)(config, `/text_templates/${id}`, { body });
318
+ }
319
+ /** DELETE /text_templates/{id} — Deletes a text template. */
320
+ function deleteTextTemplate(config, id) {
321
+ return (0, client_1.apiDelete)(config, `/text_templates/${id}`);
322
+ }
323
+ /** GET /textbanks — Lists textbanks. */
324
+ function listTextbanks(config, params = {}) {
325
+ return (0, client_1.apiGet)(config, "/textbanks", { query: Object.assign({}, params) });
326
+ }
327
+ /** GET /textbanks/{id} — Shows a single textbank. */
328
+ function getTextbank(config, id) {
329
+ return (0, client_1.apiGet)(config, `/textbanks/${id}`);
330
+ }
331
+ /** POST /texts — Sends a text message. Parameters are passed as query string. */
332
+ function sendText(config, params) {
333
+ return (0, client_1.apiPost)(config, "/texts", { query: Object.assign({}, params) });
334
+ }
335
+ /** GET /texts — Retrieves a list of texts. */
336
+ function listTexts(config, params = {}) {
337
+ return (0, client_1.apiGet)(config, "/texts", { query: Object.assign({}, params), schema: schemas_1.textsResponse });
338
+ }
339
+ /** POST /user_actions — Creates a user action. */
340
+ function createUserAction(config, body) {
341
+ return (0, client_1.apiPost)(config, "/user_actions", { body });
342
+ }
343
+ /* ------------------------------------------------------------------ *
344
+ * User Lists
345
+ * ------------------------------------------------------------------ */
346
+ /** GET /user_lists — Lists user lists. */
347
+ function listUserLists(config, params = {}) {
348
+ return (0, client_1.apiGet)(config, "/user_lists", { query: Object.assign({}, params) });
349
+ }
350
+ /** GET /user_lists/{id} — Shows a single user list. */
351
+ function getUserList(config, id) {
352
+ return (0, client_1.apiGet)(config, `/user_lists/${id}`);
353
+ }
354
+ /** POST /user_notes — Creates a user note. Parameters are passed as query string. */
355
+ function createUserNote(config, params) {
356
+ return (0, client_1.apiPost)(config, "/user_notes", { query: Object.assign({}, params) });
357
+ }
358
+ /** POST /users — Creates or updates a user. */
359
+ function createUser(config, body) {
360
+ return (0, client_1.apiPost)(config, "/users", { body });
361
+ }
362
+ /** GET /users — Retrieves a list of users. */
363
+ function listUsers(config, params = {}) {
364
+ return (0, client_1.apiGet)(config, "/users", { query: Object.assign({}, params), schema: schemas_1.usersResponse });
365
+ }
366
+ /** PUT /users/{id} — Updates a user. */
367
+ function updateUser(config, id, body) {
368
+ return (0, client_1.apiPut)(config, `/users/${id}`, { body });
369
+ }
package/dist/index.d.ts CHANGED
@@ -1,5 +1,21 @@
1
- import { default as createSDK } from "./.api/apis/solidarity-tech/index";
2
- export * from "./.api/apis/solidarity-tech/index";
3
- export { createSDK };
4
- export { createSDK as sdk };
5
- export default createSDK;
1
+ import type { ClientConfig } from "./client";
2
+ import * as endpoints from "./endpoints";
3
+ export * from "./client";
4
+ export * from "./schemas";
5
+ export * from "./endpoints";
6
+ type Bound<F> = F extends (config: ClientConfig, ...args: infer A) => infer R ? (...args: A) => R : never;
7
+ /** All endpoint functions with their leading `ClientConfig` argument bound. */
8
+ export type SolidarityClient = {
9
+ [K in keyof typeof endpoints]: Bound<(typeof endpoints)[K]>;
10
+ };
11
+ /**
12
+ * Binds a {@link ClientConfig} to every endpoint so they can be called without
13
+ * passing the config each time:
14
+ *
15
+ * ```ts
16
+ * const client = createClient({ apiKey: "..." });
17
+ * const res = await client.listUsers({ _limit: 50 });
18
+ * ```
19
+ */
20
+ export declare function createClient(config: ClientConfig): SolidarityClient;
21
+ export default createClient;
package/dist/index.js CHANGED
@@ -10,16 +10,41 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
10
10
  if (k2 === undefined) k2 = k;
11
11
  o[k2] = m[k];
12
12
  }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
13
25
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
26
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
27
  };
16
- var __importDefault = (this && this.__importDefault) || function (mod) {
17
- return (mod && mod.__esModule) ? mod : { "default": mod };
18
- };
19
28
  Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.sdk = exports.createSDK = void 0;
21
- const index_1 = __importDefault(require("./.api/apis/solidarity-tech/index"));
22
- Object.defineProperty(exports, "createSDK", { enumerable: true, get: function () { return index_1.default; } });
23
- Object.defineProperty(exports, "sdk", { enumerable: true, get: function () { return index_1.default; } });
24
- __exportStar(require("./.api/apis/solidarity-tech/index"), exports);
25
- exports.default = index_1.default;
29
+ exports.createClient = createClient;
30
+ const endpoints = __importStar(require("./endpoints"));
31
+ __exportStar(require("./client"), exports);
32
+ __exportStar(require("./schemas"), exports);
33
+ __exportStar(require("./endpoints"), exports);
34
+ /**
35
+ * Binds a {@link ClientConfig} to every endpoint so they can be called without
36
+ * passing the config each time:
37
+ *
38
+ * ```ts
39
+ * const client = createClient({ apiKey: "..." });
40
+ * const res = await client.listUsers({ _limit: 50 });
41
+ * ```
42
+ */
43
+ function createClient(config) {
44
+ const bound = {};
45
+ for (const [name, fn] of Object.entries(endpoints)) {
46
+ bound[name] = (...args) => fn(config, ...args);
47
+ }
48
+ return bound;
49
+ }
50
+ exports.default = createClient;