@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.
- package/dist/client.d.ts +77 -0
- package/dist/client.js +145 -0
- package/dist/endpoints.d.ts +377 -0
- package/dist/endpoints.js +369 -0
- package/dist/index.d.ts +21 -5
- package/dist/index.js +34 -9
- package/dist/schemas.d.ts +255 -0
- package/dist/schemas.js +136 -0
- package/package.json +11 -12
- package/dist/.api/apis/solidarity-tech/index.d.ts +0 -568
- package/dist/.api/apis/solidarity-tech/index.js +0 -759
- package/dist/.api/apis/solidarity-tech/openapi.json +0 -5849
- package/dist/.api/apis/solidarity-tech/schemas.d.ts +0 -4682
- package/dist/.api/apis/solidarity-tech/schemas.js +0 -184
- package/dist/.api/apis/solidarity-tech/types.d.ts +0 -122
- package/dist/.api/apis/solidarity-tech/types.js +0 -2
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { ZodType } from "zod";
|
|
3
|
+
/** Default base URL, taken from the OpenAPI `servers` entry. */
|
|
4
|
+
export declare const DEFAULT_BASE_URL = "https://api.solidarity.tech/v1";
|
|
5
|
+
/** Configuration shared by every endpoint call. */
|
|
6
|
+
export interface ClientConfig {
|
|
7
|
+
/** Bearer token used for the `Authorization` header. */
|
|
8
|
+
apiKey: string;
|
|
9
|
+
/** Override the API base URL. Defaults to {@link DEFAULT_BASE_URL}. */
|
|
10
|
+
baseUrl?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Override the `fetch` implementation. Defaults to the global `fetch`,
|
|
13
|
+
* which is available in browsers, Node 18+, Bun, Deno and other runtimes.
|
|
14
|
+
*/
|
|
15
|
+
fetch?: typeof fetch;
|
|
16
|
+
}
|
|
17
|
+
type QueryValue = string | number | boolean | null | undefined | Array<string | number>;
|
|
18
|
+
/** Query string parameters. `undefined` and `null` values are omitted. */
|
|
19
|
+
export type QueryParams = Record<string, QueryValue>;
|
|
20
|
+
/** Result of a successful request whose body passed validation. */
|
|
21
|
+
export interface ApiSuccess<T> {
|
|
22
|
+
ok: true;
|
|
23
|
+
status: number;
|
|
24
|
+
data: T;
|
|
25
|
+
}
|
|
26
|
+
/** A non-2xx response, a network failure, or a body that failed validation. */
|
|
27
|
+
export interface ApiFailure {
|
|
28
|
+
ok: false;
|
|
29
|
+
status: number;
|
|
30
|
+
error: ApiError;
|
|
31
|
+
/** The raw parsed body, when one was received. */
|
|
32
|
+
data: unknown;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Every endpoint resolves to one of these instead of throwing, mirroring how
|
|
36
|
+
* `fetch` surfaces HTTP errors as ordinary return values.
|
|
37
|
+
*/
|
|
38
|
+
export type ApiResult<T> = ApiSuccess<T> | ApiFailure;
|
|
39
|
+
export type ApiError =
|
|
40
|
+
/** The server replied with a non-2xx status. */
|
|
41
|
+
{
|
|
42
|
+
type: "http";
|
|
43
|
+
status: number;
|
|
44
|
+
message: string;
|
|
45
|
+
body: unknown;
|
|
46
|
+
}
|
|
47
|
+
/** `fetch` rejected (DNS, connection, abort, etc.). */
|
|
48
|
+
| {
|
|
49
|
+
type: "network";
|
|
50
|
+
message: string;
|
|
51
|
+
cause: unknown;
|
|
52
|
+
}
|
|
53
|
+
/** The 2xx body did not match the expected zod schema. */
|
|
54
|
+
| {
|
|
55
|
+
type: "validation";
|
|
56
|
+
message: string;
|
|
57
|
+
issues: z.core.$ZodIssue[];
|
|
58
|
+
received: unknown;
|
|
59
|
+
};
|
|
60
|
+
interface GetOptions<T> {
|
|
61
|
+
query?: QueryParams;
|
|
62
|
+
schema?: ZodType<T>;
|
|
63
|
+
}
|
|
64
|
+
interface WriteOptions<T> {
|
|
65
|
+
query?: QueryParams;
|
|
66
|
+
body?: unknown;
|
|
67
|
+
schema?: ZodType<T>;
|
|
68
|
+
}
|
|
69
|
+
/** Shared GET helper. Omit `schema` to receive the raw body as `unknown`. */
|
|
70
|
+
export declare function apiGet<T = unknown>(config: ClientConfig, path: string, options?: GetOptions<T>): Promise<ApiResult<T>>;
|
|
71
|
+
/** Shared POST helper. Omit `schema` to receive the raw body as `unknown`. */
|
|
72
|
+
export declare function apiPost<T = unknown>(config: ClientConfig, path: string, options?: WriteOptions<T>): Promise<ApiResult<T>>;
|
|
73
|
+
/** Shared PUT helper. Omit `schema` to receive the raw body as `unknown`. */
|
|
74
|
+
export declare function apiPut<T = unknown>(config: ClientConfig, path: string, options?: WriteOptions<T>): Promise<ApiResult<T>>;
|
|
75
|
+
/** Shared DELETE helper. Omit `schema` to receive the raw body as `unknown`. */
|
|
76
|
+
export declare function apiDelete<T = unknown>(config: ClientConfig, path: string, options?: WriteOptions<T>): Promise<ApiResult<T>>;
|
|
77
|
+
export {};
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.DEFAULT_BASE_URL = void 0;
|
|
13
|
+
exports.apiGet = apiGet;
|
|
14
|
+
exports.apiPost = apiPost;
|
|
15
|
+
exports.apiPut = apiPut;
|
|
16
|
+
exports.apiDelete = apiDelete;
|
|
17
|
+
const zod_1 = require("zod");
|
|
18
|
+
/** Default base URL, taken from the OpenAPI `servers` entry. */
|
|
19
|
+
exports.DEFAULT_BASE_URL = "https://api.solidarity.tech/v1";
|
|
20
|
+
function buildUrl(baseUrl, path, query) {
|
|
21
|
+
const url = new URL(baseUrl.replace(/\/$/, "") + path);
|
|
22
|
+
if (query) {
|
|
23
|
+
for (const [key, value] of Object.entries(query)) {
|
|
24
|
+
if (value === undefined || value === null)
|
|
25
|
+
continue;
|
|
26
|
+
if (Array.isArray(value)) {
|
|
27
|
+
for (const item of value)
|
|
28
|
+
url.searchParams.append(key, String(item));
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
url.searchParams.append(key, String(value));
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return url.toString();
|
|
36
|
+
}
|
|
37
|
+
function parseBody(res) {
|
|
38
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
const text = yield res.text();
|
|
40
|
+
try {
|
|
41
|
+
return JSON.parse(text);
|
|
42
|
+
}
|
|
43
|
+
catch (_a) {
|
|
44
|
+
return text;
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
function request(config, method, path, options) {
|
|
49
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
var _a, _b;
|
|
51
|
+
const fetchImpl = (_a = config.fetch) !== null && _a !== void 0 ? _a : fetch;
|
|
52
|
+
const url = buildUrl((_b = config.baseUrl) !== null && _b !== void 0 ? _b : exports.DEFAULT_BASE_URL, path, options.query);
|
|
53
|
+
const headers = {
|
|
54
|
+
Authorization: `Bearer ${config.apiKey}`,
|
|
55
|
+
Accept: "application/json",
|
|
56
|
+
};
|
|
57
|
+
const hasBody = options.body !== undefined;
|
|
58
|
+
if (hasBody)
|
|
59
|
+
headers["Content-Type"] = "application/json";
|
|
60
|
+
let res;
|
|
61
|
+
try {
|
|
62
|
+
res = yield fetchImpl(url, {
|
|
63
|
+
method,
|
|
64
|
+
headers,
|
|
65
|
+
body: hasBody ? JSON.stringify(options.body) : undefined,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
catch (cause) {
|
|
69
|
+
return {
|
|
70
|
+
ok: false,
|
|
71
|
+
status: 0,
|
|
72
|
+
data: undefined,
|
|
73
|
+
error: {
|
|
74
|
+
type: "network",
|
|
75
|
+
message: cause instanceof Error ? cause.message : "Network request failed",
|
|
76
|
+
cause,
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
const raw = yield parseBody(res);
|
|
81
|
+
if (!res.ok) {
|
|
82
|
+
return {
|
|
83
|
+
ok: false,
|
|
84
|
+
status: res.status,
|
|
85
|
+
data: raw,
|
|
86
|
+
error: {
|
|
87
|
+
type: "http",
|
|
88
|
+
status: res.status,
|
|
89
|
+
message: res.statusText || `Request failed with status ${res.status}`,
|
|
90
|
+
body: raw,
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
const parsed = options.schema.safeParse(raw);
|
|
95
|
+
if (!parsed.success) {
|
|
96
|
+
return {
|
|
97
|
+
ok: false,
|
|
98
|
+
status: res.status,
|
|
99
|
+
data: raw,
|
|
100
|
+
error: {
|
|
101
|
+
type: "validation",
|
|
102
|
+
message: "Response body did not match the expected schema",
|
|
103
|
+
issues: parsed.error.issues,
|
|
104
|
+
received: raw,
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
return { ok: true, status: res.status, data: parsed.data };
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
/** Shared GET helper. Omit `schema` to receive the raw body as `unknown`. */
|
|
112
|
+
function apiGet(config, path, options = {}) {
|
|
113
|
+
var _a;
|
|
114
|
+
return request(config, "GET", path, {
|
|
115
|
+
query: options.query,
|
|
116
|
+
schema: (_a = options.schema) !== null && _a !== void 0 ? _a : zod_1.z.unknown(),
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
/** Shared POST helper. Omit `schema` to receive the raw body as `unknown`. */
|
|
120
|
+
function apiPost(config, path, options = {}) {
|
|
121
|
+
var _a;
|
|
122
|
+
return request(config, "POST", path, {
|
|
123
|
+
query: options.query,
|
|
124
|
+
body: options.body,
|
|
125
|
+
schema: (_a = options.schema) !== null && _a !== void 0 ? _a : zod_1.z.unknown(),
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
/** Shared PUT helper. Omit `schema` to receive the raw body as `unknown`. */
|
|
129
|
+
function apiPut(config, path, options = {}) {
|
|
130
|
+
var _a;
|
|
131
|
+
return request(config, "PUT", path, {
|
|
132
|
+
query: options.query,
|
|
133
|
+
body: options.body,
|
|
134
|
+
schema: (_a = options.schema) !== null && _a !== void 0 ? _a : zod_1.z.unknown(),
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
/** Shared DELETE helper. Omit `schema` to receive the raw body as `unknown`. */
|
|
138
|
+
function apiDelete(config, path, options = {}) {
|
|
139
|
+
var _a;
|
|
140
|
+
return request(config, "DELETE", path, {
|
|
141
|
+
query: options.query,
|
|
142
|
+
body: options.body,
|
|
143
|
+
schema: (_a = options.schema) !== null && _a !== void 0 ? _a : zod_1.z.unknown(),
|
|
144
|
+
});
|
|
145
|
+
}
|
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
import type { ApiResult, ClientConfig } from "./client";
|
|
2
|
+
import type { ActivitiesResponse, CallsResponse, ChaptersResponse, CustomUserPropertiesResponse, TextsResponse, UsersResponse } from "./schemas";
|
|
3
|
+
/** Pagination/`_since` parameters common to every list endpoint. */
|
|
4
|
+
export interface ListParams {
|
|
5
|
+
_limit?: number;
|
|
6
|
+
_offset?: number;
|
|
7
|
+
_since?: number;
|
|
8
|
+
}
|
|
9
|
+
export type ScopeType = "Organization" | "Chapter";
|
|
10
|
+
export interface Address {
|
|
11
|
+
address1?: string | null;
|
|
12
|
+
address2?: string | null;
|
|
13
|
+
city?: string | null;
|
|
14
|
+
state?: string | null;
|
|
15
|
+
zip_code?: string | null;
|
|
16
|
+
country?: string | null;
|
|
17
|
+
}
|
|
18
|
+
export interface EventLocationData {
|
|
19
|
+
components?: string | null;
|
|
20
|
+
coordinates?: string | null;
|
|
21
|
+
address_city?: string | null;
|
|
22
|
+
full_address?: string | null;
|
|
23
|
+
address_state?: string | null;
|
|
24
|
+
address_line_1?: string | null;
|
|
25
|
+
address_country?: string | null;
|
|
26
|
+
address_postal_code?: string | null;
|
|
27
|
+
}
|
|
28
|
+
export interface ListActivitiesParams extends ListParams {
|
|
29
|
+
user_id?: number;
|
|
30
|
+
}
|
|
31
|
+
/** GET /activities — Retrieves all activities. */
|
|
32
|
+
export declare function listActivities(config: ClientConfig, params?: ListActivitiesParams): Promise<ApiResult<ActivitiesResponse>>;
|
|
33
|
+
export interface ListAgentAssignmentsParams extends ListParams {
|
|
34
|
+
user_id?: number;
|
|
35
|
+
agent_user_id?: number;
|
|
36
|
+
}
|
|
37
|
+
export interface AgentAssignmentCreate {
|
|
38
|
+
user_id: number;
|
|
39
|
+
agent_user_id: number | null;
|
|
40
|
+
is_active?: boolean | null;
|
|
41
|
+
}
|
|
42
|
+
export interface AgentAssignmentUpdate {
|
|
43
|
+
user_id?: number;
|
|
44
|
+
agent_user_id?: number | null;
|
|
45
|
+
is_active?: boolean | null;
|
|
46
|
+
}
|
|
47
|
+
/** GET /agent_assignments — Lists agent assignments. */
|
|
48
|
+
export declare function listAgentAssignments(config: ClientConfig, params?: ListAgentAssignmentsParams): Promise<ApiResult<unknown>>;
|
|
49
|
+
/** POST /agent_assignments — Creates an agent assignment. */
|
|
50
|
+
export declare function createAgentAssignment(config: ClientConfig, body: AgentAssignmentCreate): Promise<ApiResult<unknown>>;
|
|
51
|
+
/** GET /agent_assignments/{id} — Shows a single agent assignment. */
|
|
52
|
+
export declare function getAgentAssignment(config: ClientConfig, id: number): Promise<ApiResult<unknown>>;
|
|
53
|
+
/** PUT /agent_assignments/{id} — Updates an agent assignment. */
|
|
54
|
+
export declare function updateAgentAssignment(config: ClientConfig, id: number, body: AgentAssignmentUpdate): Promise<ApiResult<unknown>>;
|
|
55
|
+
/** DELETE /agent_assignments/{id} — Deletes an agent assignment. */
|
|
56
|
+
export declare function deleteAgentAssignment(config: ClientConfig, id: number): Promise<ApiResult<unknown>>;
|
|
57
|
+
export interface ListCallsParams extends ListParams {
|
|
58
|
+
user_id?: number;
|
|
59
|
+
}
|
|
60
|
+
/** GET /calls — Retrieves all calls. */
|
|
61
|
+
export declare function listCalls(config: ClientConfig, params?: ListCallsParams): Promise<ApiResult<CallsResponse>>;
|
|
62
|
+
export interface ListChapterPhoneNumbersParams extends ListParams {
|
|
63
|
+
chapter_id?: number;
|
|
64
|
+
}
|
|
65
|
+
/** GET /chapter_phone_numbers — Lists chapter phone numbers. */
|
|
66
|
+
export declare function listChapterPhoneNumbers(config: ClientConfig, params?: ListChapterPhoneNumbersParams): Promise<ApiResult<unknown>>;
|
|
67
|
+
/** GET /chapters — Retrieves all chapters. */
|
|
68
|
+
export declare function listChapters(config: ClientConfig, params?: ListParams): Promise<ApiResult<ChaptersResponse>>;
|
|
69
|
+
/** GET /custom_user_properties — Retrieves all custom user properties. */
|
|
70
|
+
export declare function listCustomUserProperties(config: ClientConfig, params?: ListParams): Promise<ApiResult<CustomUserPropertiesResponse>>;
|
|
71
|
+
/** GET /email_blasts — Lists email blasts. */
|
|
72
|
+
export declare function listEmailBlasts(config: ClientConfig, params?: ListParams): Promise<ApiResult<unknown>>;
|
|
73
|
+
/** GET /email_blasts/{id} — Shows a single email blast. */
|
|
74
|
+
export declare function getEmailBlast(config: ClientConfig, id: number): Promise<ApiResult<unknown>>;
|
|
75
|
+
export interface ListEventAttendancesParams extends ListParams {
|
|
76
|
+
event_id?: number;
|
|
77
|
+
}
|
|
78
|
+
export interface EventAttendanceCreate {
|
|
79
|
+
event_id: number;
|
|
80
|
+
event_session_id: number;
|
|
81
|
+
user_id: number;
|
|
82
|
+
attended: boolean;
|
|
83
|
+
}
|
|
84
|
+
/** GET /event_attendances — Lists event attendances. */
|
|
85
|
+
export declare function listEventAttendances(config: ClientConfig, params?: ListEventAttendancesParams): Promise<ApiResult<unknown>>;
|
|
86
|
+
/** POST /event_attendances — Creates an event attendance. */
|
|
87
|
+
export declare function createEventAttendance(config: ClientConfig, body: EventAttendanceCreate): Promise<ApiResult<unknown>>;
|
|
88
|
+
export interface ListEventRsvpsParams extends ListParams {
|
|
89
|
+
event_id?: number;
|
|
90
|
+
}
|
|
91
|
+
export interface EventRsvpCreate {
|
|
92
|
+
event_id: number;
|
|
93
|
+
event_session_id: number;
|
|
94
|
+
user_id?: number;
|
|
95
|
+
is_attending: "yes" | "no" | "maybe";
|
|
96
|
+
is_confirmed?: boolean;
|
|
97
|
+
agent_user_id: number | null;
|
|
98
|
+
source?: string | null;
|
|
99
|
+
source_system?: string | null;
|
|
100
|
+
}
|
|
101
|
+
export interface EventRsvpUpdate {
|
|
102
|
+
is_attending?: "yes" | "no" | "maybe";
|
|
103
|
+
is_confirmed?: boolean;
|
|
104
|
+
agent_user_id?: number | null;
|
|
105
|
+
source?: string | null;
|
|
106
|
+
source_system?: string | null;
|
|
107
|
+
}
|
|
108
|
+
/** GET /event_rsvps — Lists event rsvps. */
|
|
109
|
+
export declare function listEventRsvps(config: ClientConfig, params?: ListEventRsvpsParams): Promise<ApiResult<unknown>>;
|
|
110
|
+
/** POST /event_rsvps — Creates an event rsvp. */
|
|
111
|
+
export declare function createEventRsvp(config: ClientConfig, body: EventRsvpCreate): Promise<ApiResult<unknown>>;
|
|
112
|
+
/** GET /event_rsvps/{id} — Shows a single event rsvp. */
|
|
113
|
+
export declare function getEventRsvp(config: ClientConfig, id: number): Promise<ApiResult<unknown>>;
|
|
114
|
+
/** PUT /event_rsvps/{id} — Updates an event rsvp. */
|
|
115
|
+
export declare function updateEventRsvp(config: ClientConfig, id: number, body: EventRsvpUpdate): Promise<ApiResult<unknown>>;
|
|
116
|
+
/** DELETE /event_rsvps/{id} — Deletes an event rsvp. */
|
|
117
|
+
export declare function deleteEventRsvp(config: ClientConfig, id: number): Promise<ApiResult<unknown>>;
|
|
118
|
+
export interface ListEventSessionsParams extends ListParams {
|
|
119
|
+
event_id?: number;
|
|
120
|
+
}
|
|
121
|
+
export interface EventSessionCreate {
|
|
122
|
+
event_id: number;
|
|
123
|
+
start_time: number | null;
|
|
124
|
+
end_time: number | null;
|
|
125
|
+
title?: string | null;
|
|
126
|
+
location_name?: string | null;
|
|
127
|
+
location_data?: EventLocationData;
|
|
128
|
+
location_address?: string | null;
|
|
129
|
+
show_rsvp_bar?: boolean | null;
|
|
130
|
+
show_title_in_form?: boolean | null;
|
|
131
|
+
}
|
|
132
|
+
export interface EventSessionUpdate {
|
|
133
|
+
start_time?: number | null;
|
|
134
|
+
end_time?: number | null;
|
|
135
|
+
title?: string | null;
|
|
136
|
+
location_name?: string | null;
|
|
137
|
+
location_address?: string | null;
|
|
138
|
+
show_rsvp_bar?: boolean | null;
|
|
139
|
+
show_title_in_form?: boolean | null;
|
|
140
|
+
}
|
|
141
|
+
/** GET /event_sessions — Lists event sessions. */
|
|
142
|
+
export declare function listEventSessions(config: ClientConfig, params?: ListEventSessionsParams): Promise<ApiResult<unknown>>;
|
|
143
|
+
/** POST /event_sessions — Creates an event session. */
|
|
144
|
+
export declare function createEventSession(config: ClientConfig, body: EventSessionCreate): Promise<ApiResult<unknown>>;
|
|
145
|
+
/** GET /event_sessions/{id} — Shows a single event session. */
|
|
146
|
+
export declare function getEventSession(config: ClientConfig, id: number): Promise<ApiResult<unknown>>;
|
|
147
|
+
/** PUT /event_sessions/{id} — Updates an event session. */
|
|
148
|
+
export declare function updateEventSession(config: ClientConfig, id: number, body: EventSessionUpdate): Promise<ApiResult<unknown>>;
|
|
149
|
+
/** DELETE /event_sessions/{id} — Deletes an event session. */
|
|
150
|
+
export declare function deleteEventSession(config: ClientConfig, id: number): Promise<ApiResult<unknown>>;
|
|
151
|
+
/** GET /events — Lists events. */
|
|
152
|
+
export declare function listEvents(config: ClientConfig, params?: ListParams): Promise<ApiResult<unknown>>;
|
|
153
|
+
/** GET /events/{id} — Shows a single event. */
|
|
154
|
+
export declare function getEvent(config: ClientConfig, id: number): Promise<ApiResult<unknown>>;
|
|
155
|
+
/** GET /organizations — Lists organizations. */
|
|
156
|
+
export declare function listOrganizations(config: ClientConfig, params?: ListParams): Promise<ApiResult<unknown>>;
|
|
157
|
+
/** GET /organizations/{id} — Shows a single organization. */
|
|
158
|
+
export declare function getOrganization(config: ClientConfig, id: number): Promise<ApiResult<unknown>>;
|
|
159
|
+
/** GET /pages — Lists pages. */
|
|
160
|
+
export declare function listPages(config: ClientConfig, params?: ListParams): Promise<ApiResult<unknown>>;
|
|
161
|
+
/** GET /pages/{id} — Shows a single page. */
|
|
162
|
+
export declare function getPage(config: ClientConfig, id: number): Promise<ApiResult<unknown>>;
|
|
163
|
+
export interface ListPhonebanksParams extends ListParams {
|
|
164
|
+
event_id?: number;
|
|
165
|
+
}
|
|
166
|
+
/** GET /phonebanks — Lists phonebanks. */
|
|
167
|
+
export declare function listPhonebanks(config: ClientConfig, params?: ListPhonebanksParams): Promise<ApiResult<unknown>>;
|
|
168
|
+
/** GET /phonebanks/{id} — Shows a single phonebank. */
|
|
169
|
+
export declare function getPhonebank(config: ClientConfig, id: number): Promise<ApiResult<unknown>>;
|
|
170
|
+
export interface ListScheduledCallsParams extends ListParams {
|
|
171
|
+
user_id?: number;
|
|
172
|
+
agent_user_id?: number;
|
|
173
|
+
}
|
|
174
|
+
/** GET /scheduled_calls — Lists scheduled calls. */
|
|
175
|
+
export declare function listScheduledCalls(config: ClientConfig, params?: ListScheduledCallsParams): Promise<ApiResult<unknown>>;
|
|
176
|
+
/** GET /scheduled_calls/{id} — Shows a single scheduled call. */
|
|
177
|
+
export declare function getScheduledCall(config: ClientConfig, id: number): Promise<ApiResult<unknown>>;
|
|
178
|
+
export interface ListScheduledTasksParams extends ListParams {
|
|
179
|
+
user_id?: number;
|
|
180
|
+
agent_user_id?: number;
|
|
181
|
+
}
|
|
182
|
+
export interface ScheduledTaskCreate {
|
|
183
|
+
due_at: string;
|
|
184
|
+
remind_at?: string | null;
|
|
185
|
+
agent_user_id?: number | null;
|
|
186
|
+
user_id: number;
|
|
187
|
+
notes?: string | null;
|
|
188
|
+
marked_as_completed?: boolean | null;
|
|
189
|
+
}
|
|
190
|
+
export interface ScheduledTaskUpdate {
|
|
191
|
+
due_at?: string;
|
|
192
|
+
remind_at?: string | null;
|
|
193
|
+
agent_user_id?: number | null;
|
|
194
|
+
user_id?: number;
|
|
195
|
+
notes?: string | null;
|
|
196
|
+
marked_as_completed?: boolean | null;
|
|
197
|
+
}
|
|
198
|
+
/** GET /scheduled_tasks — Lists scheduled tasks. */
|
|
199
|
+
export declare function listScheduledTasks(config: ClientConfig, params?: ListScheduledTasksParams): Promise<ApiResult<unknown>>;
|
|
200
|
+
/** POST /scheduled_tasks — Creates a scheduled task. */
|
|
201
|
+
export declare function createScheduledTask(config: ClientConfig, body: ScheduledTaskCreate): Promise<ApiResult<unknown>>;
|
|
202
|
+
/** GET /scheduled_tasks/{id} — Shows a single scheduled task. */
|
|
203
|
+
export declare function getScheduledTask(config: ClientConfig, id: number): Promise<ApiResult<unknown>>;
|
|
204
|
+
/** PUT /scheduled_tasks/{id} — Updates a scheduled task. */
|
|
205
|
+
export declare function updateScheduledTask(config: ClientConfig, id: number, body: ScheduledTaskUpdate): Promise<ApiResult<unknown>>;
|
|
206
|
+
/** DELETE /scheduled_tasks/{id} — Deletes a scheduled task. */
|
|
207
|
+
export declare function deleteScheduledTask(config: ClientConfig, id: number): Promise<ApiResult<unknown>>;
|
|
208
|
+
export interface ListTaskAgentsParams extends ListParams {
|
|
209
|
+
task_id?: number;
|
|
210
|
+
}
|
|
211
|
+
export interface TaskAgentCreate {
|
|
212
|
+
user_id: number;
|
|
213
|
+
task_id: number;
|
|
214
|
+
}
|
|
215
|
+
/** GET /task_agents — Lists task agents. */
|
|
216
|
+
export declare function listTaskAgents(config: ClientConfig, params?: ListTaskAgentsParams): Promise<ApiResult<unknown>>;
|
|
217
|
+
/** POST /task_agents — Creates a task agent. */
|
|
218
|
+
export declare function createTaskAgent(config: ClientConfig, body: TaskAgentCreate): Promise<ApiResult<unknown>>;
|
|
219
|
+
/** GET /task_agents/{id} — Shows a single task agent. */
|
|
220
|
+
export declare function getTaskAgent(config: ClientConfig, id: number): Promise<ApiResult<unknown>>;
|
|
221
|
+
/** DELETE /task_agents/{id} — Deletes a task agent. */
|
|
222
|
+
export declare function deleteTaskAgent(config: ClientConfig, id: number): Promise<ApiResult<unknown>>;
|
|
223
|
+
export interface ListTaskAssignmentsParams extends ListParams {
|
|
224
|
+
task_id?: number;
|
|
225
|
+
agent_user_id?: number;
|
|
226
|
+
}
|
|
227
|
+
export interface TaskAssignmentCreate {
|
|
228
|
+
user_id: number;
|
|
229
|
+
task_id: number;
|
|
230
|
+
agent_user_id?: number | null;
|
|
231
|
+
}
|
|
232
|
+
export interface TaskAssignmentUpdate {
|
|
233
|
+
agent_user_id?: number | null;
|
|
234
|
+
}
|
|
235
|
+
/** GET /task_assignments — Lists task assignments. */
|
|
236
|
+
export declare function listTaskAssignments(config: ClientConfig, params?: ListTaskAssignmentsParams): Promise<ApiResult<unknown>>;
|
|
237
|
+
/** POST /task_assignments — Creates a task assignment. */
|
|
238
|
+
export declare function createTaskAssignment(config: ClientConfig, body: TaskAssignmentCreate): Promise<ApiResult<unknown>>;
|
|
239
|
+
/** GET /task_assignments/{id} — Shows a single task assignment. */
|
|
240
|
+
export declare function getTaskAssignment(config: ClientConfig, id: number): Promise<ApiResult<unknown>>;
|
|
241
|
+
/** PUT /task_assignments/{id} — Updates a task assignment. */
|
|
242
|
+
export declare function updateTaskAssignment(config: ClientConfig, id: number, body: TaskAssignmentUpdate): Promise<ApiResult<unknown>>;
|
|
243
|
+
/** DELETE /task_assignments/{id} — Deletes a task assignment. */
|
|
244
|
+
export declare function deleteTaskAssignment(config: ClientConfig, id: number): Promise<ApiResult<unknown>>;
|
|
245
|
+
/** GET /team_members — Lists team members. */
|
|
246
|
+
export declare function listTeamMembers(config: ClientConfig, params?: ListParams): Promise<ApiResult<unknown>>;
|
|
247
|
+
/** GET /text_blasts — Lists text blasts. */
|
|
248
|
+
export declare function listTextBlasts(config: ClientConfig, params?: ListParams): Promise<ApiResult<unknown>>;
|
|
249
|
+
/** GET /text_blasts/{id} — Shows a single text blast. */
|
|
250
|
+
export declare function getTextBlast(config: ClientConfig, id: number): Promise<ApiResult<unknown>>;
|
|
251
|
+
export interface ListTextTemplatesParams extends ListParams {
|
|
252
|
+
event_id?: number;
|
|
253
|
+
}
|
|
254
|
+
export interface TextTemplateCreate {
|
|
255
|
+
name: string;
|
|
256
|
+
scope_id: number;
|
|
257
|
+
scope_type: ScopeType;
|
|
258
|
+
/** Localized template bodies keyed by 2-character language code. */
|
|
259
|
+
template?: Record<string, string>;
|
|
260
|
+
event_id?: number | null;
|
|
261
|
+
}
|
|
262
|
+
export interface TextTemplateUpdate {
|
|
263
|
+
name?: string;
|
|
264
|
+
scope_id?: number;
|
|
265
|
+
scope_type?: string;
|
|
266
|
+
template?: Record<string, string>;
|
|
267
|
+
event_id?: number | null;
|
|
268
|
+
}
|
|
269
|
+
/** GET /text_templates — Lists text templates. */
|
|
270
|
+
export declare function listTextTemplates(config: ClientConfig, params?: ListTextTemplatesParams): Promise<ApiResult<unknown>>;
|
|
271
|
+
/** POST /text_templates — Creates a text template. */
|
|
272
|
+
export declare function createTextTemplate(config: ClientConfig, body: TextTemplateCreate): Promise<ApiResult<unknown>>;
|
|
273
|
+
/** GET /text_templates/{id} — Shows a single text template. */
|
|
274
|
+
export declare function getTextTemplate(config: ClientConfig, id: number): Promise<ApiResult<unknown>>;
|
|
275
|
+
/** PUT /text_templates/{id} — Updates a text template. */
|
|
276
|
+
export declare function updateTextTemplate(config: ClientConfig, id: number, body: TextTemplateUpdate): Promise<ApiResult<unknown>>;
|
|
277
|
+
/** DELETE /text_templates/{id} — Deletes a text template. */
|
|
278
|
+
export declare function deleteTextTemplate(config: ClientConfig, id: number): Promise<ApiResult<unknown>>;
|
|
279
|
+
export interface ListTextbanksParams extends ListParams {
|
|
280
|
+
event_id?: number;
|
|
281
|
+
}
|
|
282
|
+
/** GET /textbanks — Lists textbanks. */
|
|
283
|
+
export declare function listTextbanks(config: ClientConfig, params?: ListTextbanksParams): Promise<ApiResult<unknown>>;
|
|
284
|
+
/** GET /textbanks/{id} — Shows a single textbank. */
|
|
285
|
+
export declare function getTextbank(config: ClientConfig, id: number): Promise<ApiResult<unknown>>;
|
|
286
|
+
export interface SendTextParams {
|
|
287
|
+
user_id: number;
|
|
288
|
+
body: string;
|
|
289
|
+
media_urls?: string[];
|
|
290
|
+
attach_contact_card?: boolean;
|
|
291
|
+
shorten_urls?: boolean;
|
|
292
|
+
}
|
|
293
|
+
export interface ListTextsParams {
|
|
294
|
+
user_id?: number;
|
|
295
|
+
_limit?: number;
|
|
296
|
+
_offset?: number;
|
|
297
|
+
_since?: string;
|
|
298
|
+
}
|
|
299
|
+
/** POST /texts — Sends a text message. Parameters are passed as query string. */
|
|
300
|
+
export declare function sendText(config: ClientConfig, params: SendTextParams): Promise<ApiResult<unknown>>;
|
|
301
|
+
/** GET /texts — Retrieves a list of texts. */
|
|
302
|
+
export declare function listTexts(config: ClientConfig, params?: ListTextsParams): Promise<ApiResult<TextsResponse>>;
|
|
303
|
+
export interface UserActionData {
|
|
304
|
+
phone_number?: string | null;
|
|
305
|
+
email?: string | null;
|
|
306
|
+
first_name?: string | null;
|
|
307
|
+
last_name?: string | null;
|
|
308
|
+
preferred_language?: string | null;
|
|
309
|
+
second_language?: string | null;
|
|
310
|
+
chapter_id?: number | null;
|
|
311
|
+
address?: Address | null;
|
|
312
|
+
sms_permission?: boolean | null;
|
|
313
|
+
call_permission?: boolean | null;
|
|
314
|
+
email_permission?: boolean | null;
|
|
315
|
+
custom_user_properties?: Record<string, string> | null;
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* Body for POST /user_actions. `page_id` is required; supply either an existing
|
|
319
|
+
* `user_id` or a `data` object that identifies the user by phone number/email.
|
|
320
|
+
*/
|
|
321
|
+
export interface UserActionCreate {
|
|
322
|
+
page_id: number;
|
|
323
|
+
user_id?: number | null;
|
|
324
|
+
created_at?: number | null;
|
|
325
|
+
data?: UserActionData;
|
|
326
|
+
}
|
|
327
|
+
/** POST /user_actions — Creates a user action. */
|
|
328
|
+
export declare function createUserAction(config: ClientConfig, body: UserActionCreate): Promise<ApiResult<unknown>>;
|
|
329
|
+
/** GET /user_lists — Lists user lists. */
|
|
330
|
+
export declare function listUserLists(config: ClientConfig, params?: ListParams): Promise<ApiResult<unknown>>;
|
|
331
|
+
/** GET /user_lists/{id} — Shows a single user list. */
|
|
332
|
+
export declare function getUserList(config: ClientConfig, id: number): Promise<ApiResult<unknown>>;
|
|
333
|
+
export interface CreateUserNoteParams {
|
|
334
|
+
user_id: number;
|
|
335
|
+
content: string;
|
|
336
|
+
created_at?: number;
|
|
337
|
+
}
|
|
338
|
+
/** POST /user_notes — Creates a user note. Parameters are passed as query string. */
|
|
339
|
+
export declare function createUserNote(config: ClientConfig, params: CreateUserNoteParams): Promise<ApiResult<unknown>>;
|
|
340
|
+
/**
|
|
341
|
+
* Body for POST /users. The API requires at least one of `phone_number` or
|
|
342
|
+
* `email` to identify the user.
|
|
343
|
+
*/
|
|
344
|
+
export interface UserCreate {
|
|
345
|
+
phone_number?: string | null;
|
|
346
|
+
email?: string | null;
|
|
347
|
+
first_name?: string | null;
|
|
348
|
+
last_name?: string | null;
|
|
349
|
+
preferred_language?: string;
|
|
350
|
+
second_language?: string | null;
|
|
351
|
+
chapter_id?: number | null;
|
|
352
|
+
custom_user_properties?: Record<string, string> | null;
|
|
353
|
+
address?: Address | null;
|
|
354
|
+
sms_permission?: boolean | null;
|
|
355
|
+
call_permission?: boolean | null;
|
|
356
|
+
email_permission?: boolean | null;
|
|
357
|
+
}
|
|
358
|
+
export interface UserUpdate {
|
|
359
|
+
phone_number?: string | null;
|
|
360
|
+
email?: string | null;
|
|
361
|
+
first_name?: string | null;
|
|
362
|
+
last_name?: string | null;
|
|
363
|
+
preferred_language?: string | null;
|
|
364
|
+
second_language?: string | null;
|
|
365
|
+
chapter_id?: number | null;
|
|
366
|
+
custom_user_properties?: Record<string, string> | null;
|
|
367
|
+
address?: Address | null;
|
|
368
|
+
sms_permission?: boolean | null;
|
|
369
|
+
call_permission?: boolean | null;
|
|
370
|
+
email_permission?: boolean | null;
|
|
371
|
+
}
|
|
372
|
+
/** POST /users — Creates or updates a user. */
|
|
373
|
+
export declare function createUser(config: ClientConfig, body: UserCreate): Promise<ApiResult<unknown>>;
|
|
374
|
+
/** GET /users — Retrieves a list of users. */
|
|
375
|
+
export declare function listUsers(config: ClientConfig, params?: ListParams): Promise<ApiResult<UsersResponse>>;
|
|
376
|
+
/** PUT /users/{id} — Updates a user. */
|
|
377
|
+
export declare function updateUser(config: ClientConfig, id: number, body: UserUpdate): Promise<ApiResult<unknown>>;
|