@assinafy/cli 1.0.2 → 2.0.1
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/README.md +86 -38
- package/THIRD_PARTY_NOTICES.md +972 -0
- package/dist/api.cjs +1965 -0
- package/dist/api.cjs.map +1 -0
- package/dist/api.js +1909 -0
- package/dist/api.js.map +1 -0
- package/dist/cli.cjs +3018 -1560
- package/dist/types/api/client.d.ts +88 -0
- package/dist/types/api/client.d.ts.map +1 -0
- package/dist/types/api/errors.d.ts +28 -0
- package/dist/types/api/errors.d.ts.map +1 -0
- package/dist/types/api/index.d.ts +21 -0
- package/dist/types/api/index.d.ts.map +1 -0
- package/dist/types/api/resources/assignments.d.ts +39 -0
- package/dist/types/api/resources/assignments.d.ts.map +1 -0
- package/dist/types/api/resources/authentication.d.ts +55 -0
- package/dist/types/api/resources/authentication.d.ts.map +1 -0
- package/dist/types/api/resources/base.d.ts +35 -0
- package/dist/types/api/resources/base.d.ts.map +1 -0
- package/dist/types/api/resources/documents.d.ts +124 -0
- package/dist/types/api/resources/documents.d.ts.map +1 -0
- package/dist/types/api/resources/fields.d.ts +57 -0
- package/dist/types/api/resources/fields.d.ts.map +1 -0
- package/dist/types/api/resources/signer-documents.d.ts +72 -0
- package/dist/types/api/resources/signer-documents.d.ts.map +1 -0
- package/dist/types/api/resources/signers.d.ts +25 -0
- package/dist/types/api/resources/signers.d.ts.map +1 -0
- package/dist/types/api/resources/tags.d.ts +37 -0
- package/dist/types/api/resources/tags.d.ts.map +1 -0
- package/dist/types/api/resources/templates.d.ts +21 -0
- package/dist/types/api/resources/templates.d.ts.map +1 -0
- package/dist/types/api/resources/users.d.ts +14 -0
- package/dist/types/api/resources/users.d.ts.map +1 -0
- package/dist/types/api/resources/webhooks.d.ts +17 -0
- package/dist/types/api/resources/webhooks.d.ts.map +1 -0
- package/dist/types/api/resources/workspaces.d.ts +32 -0
- package/dist/types/api/resources/workspaces.d.ts.map +1 -0
- package/dist/types/api/support/webhook-verifier.d.ts +43 -0
- package/dist/types/api/support/webhook-verifier.d.ts.map +1 -0
- package/dist/types/api/types.d.ts +926 -0
- package/dist/types/api/types.d.ts.map +1 -0
- package/dist/types/api/utils.d.ts +34 -0
- package/dist/types/api/utils.d.ts.map +1 -0
- package/docs/README.md +9 -1
- package/docs/api-operations.json +718 -0
- package/docs/api-reference.md +7228 -0
- package/docs/assignments.md +21 -1
- package/docs/auth.md +28 -12
- package/docs/config.md +0 -1
- package/docs/docs.md +0 -1
- package/docs/documents.md +45 -6
- package/docs/fields.md +4 -2
- package/docs/login.md +0 -1
- package/docs/logout.md +0 -1
- package/docs/migration-v2.md +20 -0
- package/docs/releasing.md +42 -0
- package/docs/sdk-reference.md +344 -0
- package/docs/send.md +1 -2
- package/docs/signer.md +44 -19
- package/docs/signers.md +2 -3
- package/docs/tags.md +0 -1
- package/docs/templates.md +3 -3
- package/docs/users.md +85 -0
- package/docs/webhooks.md +1 -16
- package/docs/whoami.md +0 -1
- package/docs/workspaces.md +109 -10
- package/install.ps1 +117 -13
- package/install.sh +165 -30
- package/package.json +37 -16
|
@@ -0,0 +1,926 @@
|
|
|
1
|
+
/** Document lifecycle states emitted by the API. */
|
|
2
|
+
export type DocumentStatus = 'uploading' | 'uploaded' | 'metadata_processing' | 'metadata_ready' | 'pending_signature' | 'expired' | 'certificating' | 'certificated' | 'rejected_by_signer' | 'rejected_by_user' | 'failed';
|
|
3
|
+
/** Artifact names available for document download. */
|
|
4
|
+
export type DocumentArtifactName = 'original' | 'certificated' | 'certificate-page' | 'pades' | 'bundle';
|
|
5
|
+
/** Assignment methods supported by the API. */
|
|
6
|
+
export type AssignmentMethod = 'virtual' | 'collect';
|
|
7
|
+
/** Verification methods accepted by assignment signer entries. */
|
|
8
|
+
export type AssignmentVerificationMethod = 'Email' | 'Whatsapp' | 'DigitalCertificate' | string;
|
|
9
|
+
/** Notification methods accepted by assignment signer entries. */
|
|
10
|
+
export type AssignmentNotificationMethod = 'Email' | 'Whatsapp' | string;
|
|
11
|
+
/** OAuth provider currently accepted by the Assinafy authentication API. */
|
|
12
|
+
export type SocialLoginProvider = 'google';
|
|
13
|
+
/** Minimal logger contract (compatible with console, pino, winston, etc.). */
|
|
14
|
+
export interface Logger {
|
|
15
|
+
debug: (message: string, context?: Record<string, unknown>) => void;
|
|
16
|
+
info: (message: string, context?: Record<string, unknown>) => void;
|
|
17
|
+
warn: (message: string, context?: Record<string, unknown>) => void;
|
|
18
|
+
error: (message: string, context?: Record<string, unknown>) => void;
|
|
19
|
+
}
|
|
20
|
+
/** Client configuration options. */
|
|
21
|
+
export interface AssinafyClientOptions {
|
|
22
|
+
/** Assinafy API key. Preferred authentication method (sends `X-Api-Key` header). */
|
|
23
|
+
apiKey?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Legacy access token. If provided (and `apiKey` is not), the client will send
|
|
26
|
+
* `Authorization: Bearer <token>` instead. Kept for backwards compatibility.
|
|
27
|
+
*/
|
|
28
|
+
token?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Build a client without API-key/JWT credentials. Intended only for public
|
|
31
|
+
* endpoints and signer-access-code flows.
|
|
32
|
+
*/
|
|
33
|
+
allowUnauthenticated?: boolean;
|
|
34
|
+
/** Default account (workspace) ID applied to account-scoped endpoints. */
|
|
35
|
+
accountId?: string;
|
|
36
|
+
/** Override the API base URL. Defaults to https://api.assinafy.com.br/v1. */
|
|
37
|
+
baseUrl?: string;
|
|
38
|
+
/** Allow a plaintext HTTP base URL for isolated local development only. */
|
|
39
|
+
allowInsecureHttp?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Experimental secret for {@link WebhookVerifier}. Assinafy does not publish
|
|
42
|
+
* a webhook-signature contract; do not rely on it without provider confirmation.
|
|
43
|
+
*/
|
|
44
|
+
webhookSecret?: string;
|
|
45
|
+
/** Request timeout in milliseconds. Defaults to 30_000. */
|
|
46
|
+
timeout?: number;
|
|
47
|
+
/** Optional logger. Defaults to a no-op logger. */
|
|
48
|
+
logger?: Logger;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Payload for creating a signer.
|
|
52
|
+
*
|
|
53
|
+
* The official API requires only `full_name`; email and WhatsApp are optional
|
|
54
|
+
* delivery channels.
|
|
55
|
+
*/
|
|
56
|
+
export interface ICreateSignerPayload {
|
|
57
|
+
full_name: string;
|
|
58
|
+
email?: string;
|
|
59
|
+
whatsapp_phone_number?: string;
|
|
60
|
+
/** PHP SDK compatibility alias for `whatsapp_phone_number`. */
|
|
61
|
+
phone?: string;
|
|
62
|
+
/** Brazilian tax ID (CPF). Non-digits are stripped before sending. */
|
|
63
|
+
cpf?: string;
|
|
64
|
+
metadata?: Record<string, unknown>;
|
|
65
|
+
}
|
|
66
|
+
/** Payload for updating a signer. */
|
|
67
|
+
export interface IUpdateSignerPayload {
|
|
68
|
+
full_name?: string;
|
|
69
|
+
email?: string;
|
|
70
|
+
whatsapp_phone_number?: string;
|
|
71
|
+
/** PHP SDK compatibility alias for `whatsapp_phone_number`. */
|
|
72
|
+
phone?: string;
|
|
73
|
+
/** CPF/CNPJ. Non-digits are stripped and sent as the official `government_id` field. */
|
|
74
|
+
government_id?: string;
|
|
75
|
+
/** Backwards-compatible alias for `government_id`. */
|
|
76
|
+
cpf?: string;
|
|
77
|
+
}
|
|
78
|
+
/** Signer object as returned by the API. */
|
|
79
|
+
export interface ISigner {
|
|
80
|
+
resource?: string;
|
|
81
|
+
id: string;
|
|
82
|
+
full_name: string;
|
|
83
|
+
email: string | null;
|
|
84
|
+
whatsapp_phone_number?: string | null;
|
|
85
|
+
government_id?: string | null;
|
|
86
|
+
cpf?: string | null;
|
|
87
|
+
has_accepted_terms?: boolean;
|
|
88
|
+
/** Only returned by `GET /signers/self`. */
|
|
89
|
+
has_signature?: boolean;
|
|
90
|
+
/** Only returned by `GET /signers/self`. */
|
|
91
|
+
has_initial?: boolean;
|
|
92
|
+
metadata?: Record<string, unknown>;
|
|
93
|
+
}
|
|
94
|
+
/** Signer profile returned by `GET /signers/self`. */
|
|
95
|
+
export interface ISignerSelf extends ISigner {
|
|
96
|
+
has_signature: boolean;
|
|
97
|
+
has_initial: boolean;
|
|
98
|
+
is_signature_reusable: boolean;
|
|
99
|
+
}
|
|
100
|
+
export type ICreateSignerResponse = ISigner;
|
|
101
|
+
/** Pagination metadata extracted from `X-Pagination-*` response headers. */
|
|
102
|
+
export interface PaginationMeta {
|
|
103
|
+
current_page?: number;
|
|
104
|
+
last_page?: number;
|
|
105
|
+
per_page?: number;
|
|
106
|
+
total?: number;
|
|
107
|
+
}
|
|
108
|
+
/** Shape returned by every paginated list call in the SDK. */
|
|
109
|
+
export interface PaginatedResult<T> {
|
|
110
|
+
data: T[];
|
|
111
|
+
meta?: PaginationMeta;
|
|
112
|
+
}
|
|
113
|
+
/** Direct status body used by successful API operations without a `data` member. */
|
|
114
|
+
export interface IStatusResponse {
|
|
115
|
+
status: number;
|
|
116
|
+
message: string;
|
|
117
|
+
}
|
|
118
|
+
/** Unwrapped `data: []` returned by successful delete operations. */
|
|
119
|
+
export type IEmptyResult = unknown[];
|
|
120
|
+
/** @deprecated use {@link PaginatedResult} — retained for existing type imports. */
|
|
121
|
+
export type IPaginatedResponse<T> = PaginatedResult<T>;
|
|
122
|
+
export type ISignerListResponse = PaginatedResult<ISigner>;
|
|
123
|
+
/** Signer reference accepted by the assignment endpoints. */
|
|
124
|
+
export type SignerReference = string | {
|
|
125
|
+
id?: string;
|
|
126
|
+
signer_id?: string;
|
|
127
|
+
verification_method?: AssignmentVerificationMethod;
|
|
128
|
+
notification_methods?: AssignmentNotificationMethod[];
|
|
129
|
+
/**
|
|
130
|
+
* Positive integer controlling signing order. Signers sharing a step
|
|
131
|
+
* sign in parallel; a step is activated (and its signers notified)
|
|
132
|
+
* only after every signer in the previous step has signed. If supplied
|
|
133
|
+
* for one signer it must be supplied for all, forming a contiguous
|
|
134
|
+
* sequence starting at 1.
|
|
135
|
+
*/
|
|
136
|
+
step?: number;
|
|
137
|
+
};
|
|
138
|
+
/** Payload for creating an assignment. */
|
|
139
|
+
export interface ICreateAssignmentPayload {
|
|
140
|
+
method?: AssignmentMethod;
|
|
141
|
+
/**
|
|
142
|
+
* List of signers. Each entry may be a signer id string, or an object with
|
|
143
|
+
* `id` / `signer_id`. For cost estimation, entries may omit the ID and
|
|
144
|
+
* specify only `verification_method` / `notification_methods`.
|
|
145
|
+
*
|
|
146
|
+
* The SDK normalises them to the docs-sanctioned `signers: [{ ... }]`
|
|
147
|
+
* shape before sending.
|
|
148
|
+
*/
|
|
149
|
+
signers?: SignerReference[];
|
|
150
|
+
/** Legacy field still accepted by the API docs and used by the PHP SDK. */
|
|
151
|
+
signer_ids?: string[];
|
|
152
|
+
/** Camel-case legacy alias used by the quick-start docs. */
|
|
153
|
+
signerIds?: string[];
|
|
154
|
+
message?: string;
|
|
155
|
+
expires_at?: string;
|
|
156
|
+
copy_receivers?: string[];
|
|
157
|
+
/** Field placement entries. Required when `method` is `collect`. */
|
|
158
|
+
entries?: ICollectAssignmentEntry[];
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* A field placement rectangle on a document page. Geometry values are pixels
|
|
162
|
+
* in Assinafy's 150-DPI page image, measured from the upper-left corner.
|
|
163
|
+
*/
|
|
164
|
+
export interface IDisplaySettings {
|
|
165
|
+
left: number;
|
|
166
|
+
top: number;
|
|
167
|
+
width: number;
|
|
168
|
+
height: number;
|
|
169
|
+
fontSize: number;
|
|
170
|
+
fontFamily?: string;
|
|
171
|
+
backgroundColor?: string;
|
|
172
|
+
}
|
|
173
|
+
/** One page's field placements, used by `collect`-method assignments. */
|
|
174
|
+
export interface ICollectAssignmentEntry {
|
|
175
|
+
page_id: string;
|
|
176
|
+
fields: Array<{
|
|
177
|
+
signer_id: string;
|
|
178
|
+
field_id: string;
|
|
179
|
+
display_settings?: IDisplaySettings;
|
|
180
|
+
}>;
|
|
181
|
+
}
|
|
182
|
+
/** Direct signing URL generated for one signer (inside `assignment.signing_urls`). */
|
|
183
|
+
export interface ISigningUrl {
|
|
184
|
+
signer_id: string;
|
|
185
|
+
url: string;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* One tracked notification-delivery record, returned inside
|
|
189
|
+
* `assignment.signers[].notification_history` (account-owner contexts only).
|
|
190
|
+
*/
|
|
191
|
+
export interface IAssignmentSignerNotification {
|
|
192
|
+
event: string;
|
|
193
|
+
status: string;
|
|
194
|
+
error_code?: string | null;
|
|
195
|
+
error_message?: string | null;
|
|
196
|
+
sent_at?: string | null;
|
|
197
|
+
failed_at?: string | null;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Signer as embedded inside an assignment. Extends the base {@link ISigner}
|
|
201
|
+
* with the per-assignment verification / notification / ordering fields the
|
|
202
|
+
* API returns. `completed` and `notification_history` are only present in
|
|
203
|
+
* account-owner contexts.
|
|
204
|
+
*/
|
|
205
|
+
export interface IAssignmentSigner extends ISigner {
|
|
206
|
+
verification_method?: AssignmentVerificationMethod | null;
|
|
207
|
+
notification_methods?: AssignmentNotificationMethod[] | null;
|
|
208
|
+
step?: number | null;
|
|
209
|
+
notified?: boolean | null;
|
|
210
|
+
completed?: boolean | null;
|
|
211
|
+
notification_history?: IAssignmentSignerNotification[];
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* One item (field placement instance) inside an assignment. `signer` and
|
|
215
|
+
* `field` are embedded objects whose exact shape varies by context (the API's
|
|
216
|
+
* own spec leaves them generic); `display_settings` is populated for
|
|
217
|
+
* `collect`-method items and an empty array for `virtual`/legacy ones.
|
|
218
|
+
*/
|
|
219
|
+
export interface IAssignmentItem {
|
|
220
|
+
id: string;
|
|
221
|
+
page: {
|
|
222
|
+
id: string;
|
|
223
|
+
number: number;
|
|
224
|
+
height: number;
|
|
225
|
+
width: number;
|
|
226
|
+
download_url: string;
|
|
227
|
+
} | null;
|
|
228
|
+
signer: Partial<ISigner> & Record<string, unknown>;
|
|
229
|
+
field: Partial<IFieldDefinition> & Record<string, unknown>;
|
|
230
|
+
display_settings: IDisplaySettings | unknown[] | null;
|
|
231
|
+
value: string | null;
|
|
232
|
+
completed: boolean;
|
|
233
|
+
}
|
|
234
|
+
/** Signer summary entry inside `assignment.summary.signers` (account-owner contexts). */
|
|
235
|
+
export interface IAssignmentSummarySigner extends ISigner {
|
|
236
|
+
completed: boolean;
|
|
237
|
+
}
|
|
238
|
+
/** Assignment object as returned by the API. */
|
|
239
|
+
export interface IAssignment {
|
|
240
|
+
/** Resource type (`assignment`); present in single-resource responses. */
|
|
241
|
+
resource?: string;
|
|
242
|
+
id: string;
|
|
243
|
+
sender_email?: string;
|
|
244
|
+
/** `virtual` or `collect`. Documented as `null` for some `collect` responses. */
|
|
245
|
+
method: AssignmentMethod | null;
|
|
246
|
+
/** ISO 8601 timestamp, or `null` when the assignment does not expire. */
|
|
247
|
+
expires_at?: string | null;
|
|
248
|
+
expiration?: string;
|
|
249
|
+
message?: string | null;
|
|
250
|
+
signers: IAssignmentSigner[];
|
|
251
|
+
/** Request payloads use signer IDs; responses may expand them to objects. */
|
|
252
|
+
copy_receivers?: Array<string | Record<string, unknown>>;
|
|
253
|
+
items?: IAssignmentItem[];
|
|
254
|
+
summary?: {
|
|
255
|
+
signer_count: number;
|
|
256
|
+
completed_count: number;
|
|
257
|
+
signers: IAssignmentSummarySigner[];
|
|
258
|
+
};
|
|
259
|
+
signing_urls?: ISigningUrl[];
|
|
260
|
+
}
|
|
261
|
+
export type ICreateAssignmentResponse = IAssignment;
|
|
262
|
+
export interface IResendEmailResponse {
|
|
263
|
+
is_sent?: boolean;
|
|
264
|
+
document_id?: string;
|
|
265
|
+
signer_id?: string;
|
|
266
|
+
}
|
|
267
|
+
/** One line item in a cost-estimation `breakdown`. */
|
|
268
|
+
export interface IEstimateCostBreakdownItem {
|
|
269
|
+
code: string;
|
|
270
|
+
name: string;
|
|
271
|
+
cost: number;
|
|
272
|
+
quantity: number;
|
|
273
|
+
unit_cost: number;
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* Cost-estimation response shared by the assignment `estimate-cost` and the
|
|
277
|
+
* template `documents/estimate-cost` endpoints (identical shape per the docs).
|
|
278
|
+
*/
|
|
279
|
+
export interface IEstimateCostResponse {
|
|
280
|
+
documents: number;
|
|
281
|
+
credits: number;
|
|
282
|
+
needs_extra_document: boolean;
|
|
283
|
+
extra_document_cost: number;
|
|
284
|
+
total_credits: number;
|
|
285
|
+
breakdown: IEstimateCostBreakdownItem[];
|
|
286
|
+
document_balance: number;
|
|
287
|
+
credit_balance: number;
|
|
288
|
+
has_sufficient_resources: boolean;
|
|
289
|
+
blocking_reason: 'PendingPayment' | 'InsufficientDocuments' | 'InsufficientCredits' | null;
|
|
290
|
+
message: string | null;
|
|
291
|
+
}
|
|
292
|
+
/** Cost-estimation response for resending a single signer notification. */
|
|
293
|
+
export type IResendCostEstimate = IEstimateCostResponse;
|
|
294
|
+
/** Webhook payload envelope. */
|
|
295
|
+
export interface IWebhookPayload {
|
|
296
|
+
id?: number;
|
|
297
|
+
event?: string;
|
|
298
|
+
type?: string;
|
|
299
|
+
message?: string | null;
|
|
300
|
+
payload?: Record<string, unknown> | null;
|
|
301
|
+
origin?: Record<string, unknown> | null;
|
|
302
|
+
subject?: Record<string, unknown>;
|
|
303
|
+
object?: Record<string, unknown>;
|
|
304
|
+
account_id?: string;
|
|
305
|
+
data?: {
|
|
306
|
+
document_uuid?: string;
|
|
307
|
+
document_id?: string;
|
|
308
|
+
[key: string]: unknown;
|
|
309
|
+
};
|
|
310
|
+
[key: string]: unknown;
|
|
311
|
+
}
|
|
312
|
+
/** Known webhook event names. */
|
|
313
|
+
export type WebhookEventType = 'document_uploaded' | 'document_metadata_ready' | 'document_prepared' | 'assignment_created' | 'document_ready' | 'signature_requested' | 'signer_created' | 'signer_email_verified' | 'signer_whatsapp_verified' | 'signer_data_confirmed' | 'signer_viewed_document' | 'signer_signed_document' | 'signer_rejected_document' | 'user_rejected_document' | 'document_processing_failed' | 'template_created' | 'template_processed' | 'template_processing_failed';
|
|
314
|
+
/** Rendered document-page metadata returned by document and template endpoints. */
|
|
315
|
+
export interface IDocumentPage {
|
|
316
|
+
id: string;
|
|
317
|
+
number: number;
|
|
318
|
+
height: number;
|
|
319
|
+
width: number;
|
|
320
|
+
download_url: string;
|
|
321
|
+
}
|
|
322
|
+
/** Artifact URLs embedded in document responses. */
|
|
323
|
+
export interface IDocumentArtifacts {
|
|
324
|
+
original: string;
|
|
325
|
+
certificated?: string;
|
|
326
|
+
'certificate-page'?: string;
|
|
327
|
+
pades?: string;
|
|
328
|
+
bundle?: string;
|
|
329
|
+
thumbnail?: string;
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* Document listing item (paginated).
|
|
333
|
+
*
|
|
334
|
+
* The list endpoint auto-expands `assignment` and `pages`, so live list items
|
|
335
|
+
* carry the full document shape — `artifacts`, `pages`, `assignment`,
|
|
336
|
+
* `signing_url`, `decline_reason` and `declined_by` are all present (verified
|
|
337
|
+
* against the sandbox). They are optional here because the exact set can vary
|
|
338
|
+
* by document status.
|
|
339
|
+
*/
|
|
340
|
+
export interface IDocumentListItem {
|
|
341
|
+
resource?: string;
|
|
342
|
+
id: string;
|
|
343
|
+
name: string;
|
|
344
|
+
status: DocumentStatus;
|
|
345
|
+
account_id?: string;
|
|
346
|
+
template_id?: string | null;
|
|
347
|
+
/** Tags attached to the document (inline `{ id, name, color }` shape). */
|
|
348
|
+
tags?: IInlineTag[];
|
|
349
|
+
/** Downloadable artifact URLs (`original` always present once processed). */
|
|
350
|
+
artifacts?: IDocumentArtifacts;
|
|
351
|
+
/** Rendered page metadata (auto-expanded by the list endpoint). */
|
|
352
|
+
pages?: IDocumentPage[];
|
|
353
|
+
/** Embedded assignment (auto-expanded); `null` before signatures are requested. */
|
|
354
|
+
assignment?: IAssignment | null;
|
|
355
|
+
/** Direct signing URL when an assignment is active. */
|
|
356
|
+
signing_url?: string | null;
|
|
357
|
+
decline_reason?: string | null;
|
|
358
|
+
declined_by?: ISigner | string | null;
|
|
359
|
+
created_at: string;
|
|
360
|
+
updated_at?: string;
|
|
361
|
+
is_closed?: boolean;
|
|
362
|
+
}
|
|
363
|
+
export type IDocumentListResponse = PaginatedResult<IDocumentListItem>;
|
|
364
|
+
/** Query parameters accepted by `documents.list`. */
|
|
365
|
+
export interface IDocumentListParams extends IListParams {
|
|
366
|
+
/** Filter by document status, e.g. `pending_signature`. */
|
|
367
|
+
status?: DocumentStatus | string;
|
|
368
|
+
/** Filter by signature method (`virtual` or `collect`). */
|
|
369
|
+
method?: AssignmentMethod;
|
|
370
|
+
/** Comma-separated list of tag IDs (AND semantics). */
|
|
371
|
+
tags?: string;
|
|
372
|
+
search?: string;
|
|
373
|
+
sort?: 'name' | '-name' | 'updated_at' | '-updated_at';
|
|
374
|
+
}
|
|
375
|
+
/** Query parameters accepted by the lightweight document search endpoint. */
|
|
376
|
+
export interface IDocumentSearchParams extends IListParams {
|
|
377
|
+
status?: DocumentStatus | string;
|
|
378
|
+
search?: string;
|
|
379
|
+
/** Live-verified extension; absent from the published OpenAPI. */
|
|
380
|
+
sort?: 'name' | '-name' | 'updated_at' | '-updated_at';
|
|
381
|
+
}
|
|
382
|
+
/** Document upload response. */
|
|
383
|
+
export interface IDocumentUploadResponse {
|
|
384
|
+
resource?: string;
|
|
385
|
+
id: string;
|
|
386
|
+
account_id: string;
|
|
387
|
+
template_id: string | null;
|
|
388
|
+
name: string;
|
|
389
|
+
status: DocumentStatus;
|
|
390
|
+
/** Absent immediately after upload; present once a signature request is active. */
|
|
391
|
+
assignment?: IAssignment | null;
|
|
392
|
+
/** Direct signing URL; present once the document has been processed. */
|
|
393
|
+
signing_url?: string | null;
|
|
394
|
+
artifacts: IDocumentArtifacts;
|
|
395
|
+
pages: IDocumentPage[];
|
|
396
|
+
/** Tags attached to the document (inline `{ id, name, color }` shape). */
|
|
397
|
+
tags?: IInlineTag[];
|
|
398
|
+
created_at: string;
|
|
399
|
+
updated_at: string;
|
|
400
|
+
is_closed: boolean;
|
|
401
|
+
decline_reason: string | null;
|
|
402
|
+
declined_by: ISigner | null;
|
|
403
|
+
}
|
|
404
|
+
/** Detailed document response. */
|
|
405
|
+
export interface IDocumentDetailsResponse {
|
|
406
|
+
resource?: string;
|
|
407
|
+
id: string;
|
|
408
|
+
account_id: string;
|
|
409
|
+
template_id?: string | null;
|
|
410
|
+
name: string;
|
|
411
|
+
status: DocumentStatus;
|
|
412
|
+
assignment: IAssignment | null;
|
|
413
|
+
download_url?: string;
|
|
414
|
+
download_final_url?: string;
|
|
415
|
+
signing_url?: string;
|
|
416
|
+
artifacts?: IDocumentArtifacts;
|
|
417
|
+
/** Omitted by the signer-side `GET /signers/{id}/document` endpoint. */
|
|
418
|
+
pages?: IDocumentPage[];
|
|
419
|
+
/** Tags attached to the document (inline `{ id, name, color }` shape). */
|
|
420
|
+
tags?: IInlineTag[];
|
|
421
|
+
created_at: string;
|
|
422
|
+
updated_at: string;
|
|
423
|
+
is_closed: boolean;
|
|
424
|
+
decline_reason?: string | null;
|
|
425
|
+
declined_by?: ISigner | null;
|
|
426
|
+
activities?: Array<IDocumentActivity>;
|
|
427
|
+
}
|
|
428
|
+
export interface IDocumentActivity {
|
|
429
|
+
id: number;
|
|
430
|
+
event: string;
|
|
431
|
+
message: string;
|
|
432
|
+
/** Event-specific payload snapshot. Object for most events, occasionally `[]`. */
|
|
433
|
+
payload?: Record<string, unknown> | unknown[];
|
|
434
|
+
/** Request origin (`ip` / `user-agent`) when available; `null` for system events. */
|
|
435
|
+
origin: {
|
|
436
|
+
ip?: string;
|
|
437
|
+
'user-agent'?: string;
|
|
438
|
+
} | string | null;
|
|
439
|
+
created_at: string;
|
|
440
|
+
}
|
|
441
|
+
/** Progress summary returned by `documents.getSigningProgress`. */
|
|
442
|
+
export interface ISigningProgress {
|
|
443
|
+
signed: number;
|
|
444
|
+
total: number;
|
|
445
|
+
percentage: number;
|
|
446
|
+
pending: number;
|
|
447
|
+
}
|
|
448
|
+
/** Query parameters accepted by paginated list endpoints. */
|
|
449
|
+
export interface IListParams {
|
|
450
|
+
page?: number;
|
|
451
|
+
per_page?: number;
|
|
452
|
+
'per-page'?: number;
|
|
453
|
+
/** @deprecated Prefer the endpoint-specific list parameter type. */
|
|
454
|
+
search?: string;
|
|
455
|
+
/** @deprecated Prefer the endpoint-specific list parameter type. */
|
|
456
|
+
sort?: string;
|
|
457
|
+
/** @deprecated Prefer the endpoint-specific list parameter type. */
|
|
458
|
+
[key: string]: string | number | boolean | undefined;
|
|
459
|
+
}
|
|
460
|
+
/** Live-verified assignment list extension; absent from the published OpenAPI. */
|
|
461
|
+
export interface IAssignmentListParams extends IListParams {
|
|
462
|
+
sort?: 'created_at' | '-created_at';
|
|
463
|
+
}
|
|
464
|
+
/** Published template filters plus a live-verified name sort extension. */
|
|
465
|
+
export interface ITemplateListParams extends IListParams {
|
|
466
|
+
search?: string;
|
|
467
|
+
sort?: 'name' | '-name';
|
|
468
|
+
}
|
|
469
|
+
/** Published signer filters plus a live-verified full-name sort extension. */
|
|
470
|
+
export interface ISignerListParams extends IListParams {
|
|
471
|
+
search?: string;
|
|
472
|
+
sort?: 'full_name' | '-full_name';
|
|
473
|
+
}
|
|
474
|
+
/** Signer-side document list compatibility filters. */
|
|
475
|
+
export interface ISignerDocumentListParams extends IListParams {
|
|
476
|
+
search?: string;
|
|
477
|
+
sort?: string;
|
|
478
|
+
}
|
|
479
|
+
/** Workspace creation payload. */
|
|
480
|
+
export interface ICreateWorkspacePayload {
|
|
481
|
+
name: string;
|
|
482
|
+
notification_sender_type?: NotificationSenderType;
|
|
483
|
+
/** Undocumented compatibility field retained until sandbox support is disproved. */
|
|
484
|
+
primary_color?: string;
|
|
485
|
+
/** Undocumented compatibility field retained until sandbox support is disproved. */
|
|
486
|
+
secondary_color?: string;
|
|
487
|
+
}
|
|
488
|
+
export interface IUpdateWorkspacePayload {
|
|
489
|
+
name?: string;
|
|
490
|
+
notification_sender_type?: NotificationSenderType;
|
|
491
|
+
/** Undocumented compatibility field retained until sandbox support is disproved. */
|
|
492
|
+
primary_color?: string | null;
|
|
493
|
+
/** Undocumented compatibility field retained until sandbox support is disproved. */
|
|
494
|
+
secondary_color?: string | null;
|
|
495
|
+
}
|
|
496
|
+
export interface IWorkspaceResponse {
|
|
497
|
+
resource?: string;
|
|
498
|
+
id: string;
|
|
499
|
+
name: string;
|
|
500
|
+
primary_color?: string | null;
|
|
501
|
+
secondary_color?: string | null;
|
|
502
|
+
notification_sender_type?: NotificationSenderType;
|
|
503
|
+
roles?: string[];
|
|
504
|
+
is_delete_allowed?: boolean;
|
|
505
|
+
created_at: string;
|
|
506
|
+
}
|
|
507
|
+
export interface IWorkspaceListItem extends IWorkspaceResponse {
|
|
508
|
+
is_delete_allowed: boolean;
|
|
509
|
+
roles: string[];
|
|
510
|
+
}
|
|
511
|
+
export type IWorkspaceListResponse = PaginatedResult<IWorkspaceListItem>;
|
|
512
|
+
export type NotificationSenderType = 'User' | 'Account';
|
|
513
|
+
/** Branding details returned by `GET /accounts/{accountId}/theme`. */
|
|
514
|
+
export interface IAccountTheme {
|
|
515
|
+
account_name: string;
|
|
516
|
+
primary_color: string;
|
|
517
|
+
secondary_color: string | null;
|
|
518
|
+
logo: string | null;
|
|
519
|
+
}
|
|
520
|
+
/** Query parameters shared by account and user document statistics. */
|
|
521
|
+
export interface IDocumentStatsParams {
|
|
522
|
+
granularity?: 'monthly' | 'daily';
|
|
523
|
+
/** Required in `YYYY-MM` form when `granularity` is `daily`. */
|
|
524
|
+
month?: string;
|
|
525
|
+
}
|
|
526
|
+
/** One period in an account/user document-funnel statistics response. */
|
|
527
|
+
export interface IDocumentStatsRow {
|
|
528
|
+
period: string;
|
|
529
|
+
documents_uploaded: number;
|
|
530
|
+
documents_sent: number;
|
|
531
|
+
signature_requests: number;
|
|
532
|
+
signature_requests_email: number;
|
|
533
|
+
signature_requests_whatsapp: number;
|
|
534
|
+
signature_requests_viewed: number;
|
|
535
|
+
signature_requests_completed: number;
|
|
536
|
+
documents_certified: number;
|
|
537
|
+
}
|
|
538
|
+
/** Options for uploading a workspace logo. */
|
|
539
|
+
export interface IUploadAccountLogoOptions {
|
|
540
|
+
fileName?: string;
|
|
541
|
+
contentType?: string;
|
|
542
|
+
}
|
|
543
|
+
/** Webhook subscription payload. */
|
|
544
|
+
export interface IWebhookRegisterPayload {
|
|
545
|
+
url: string;
|
|
546
|
+
email: string;
|
|
547
|
+
events?: WebhookEventType[] | string[];
|
|
548
|
+
is_active?: boolean;
|
|
549
|
+
}
|
|
550
|
+
export interface IWebhookSubscription {
|
|
551
|
+
id?: string;
|
|
552
|
+
/** Documented as `string|null` — `null` when no endpoint URL is configured. */
|
|
553
|
+
url: string | null;
|
|
554
|
+
/** Documented as `string|null` — `null` when no contact email is configured. */
|
|
555
|
+
email: string | null;
|
|
556
|
+
events: string[];
|
|
557
|
+
is_active: boolean;
|
|
558
|
+
created_at?: string | null;
|
|
559
|
+
updated_at?: string | null;
|
|
560
|
+
}
|
|
561
|
+
export interface IWebhookEventTypeInfo {
|
|
562
|
+
id: WebhookEventType | string;
|
|
563
|
+
description: string;
|
|
564
|
+
}
|
|
565
|
+
export interface IWebhookDispatch {
|
|
566
|
+
resource?: string;
|
|
567
|
+
id: string;
|
|
568
|
+
event: WebhookEventType | string;
|
|
569
|
+
activity_id: number;
|
|
570
|
+
endpoint: string | null;
|
|
571
|
+
payload: IWebhookPayload | Record<string, unknown> | null;
|
|
572
|
+
delivered: boolean;
|
|
573
|
+
http_status: number | null;
|
|
574
|
+
response_body: string | null;
|
|
575
|
+
error: string | null;
|
|
576
|
+
/** ISO 8601 timestamp (verified against the sandbox — not a unix epoch number). */
|
|
577
|
+
created_at: string;
|
|
578
|
+
/** ISO 8601 timestamp (verified against the sandbox — not a unix epoch number). */
|
|
579
|
+
updated_at?: string;
|
|
580
|
+
}
|
|
581
|
+
export interface IWebhookDispatchListParams extends IListParams {
|
|
582
|
+
event?: WebhookEventType | string;
|
|
583
|
+
delivered?: boolean | 'true' | 'false';
|
|
584
|
+
from?: number;
|
|
585
|
+
to?: number;
|
|
586
|
+
/** Live-verified extension; absent from the published OpenAPI. */
|
|
587
|
+
sort?: 'created_at' | '-created_at';
|
|
588
|
+
}
|
|
589
|
+
/** Shape of the high-level `uploadAndRequestSignatures` helper result. */
|
|
590
|
+
export interface IUploadAndRequestSignaturesResult {
|
|
591
|
+
document: IDocumentUploadResponse;
|
|
592
|
+
assignment: IAssignment;
|
|
593
|
+
signer_ids: string[];
|
|
594
|
+
}
|
|
595
|
+
/** Input for a signer in `uploadAndRequestSignatures`. */
|
|
596
|
+
export interface IUploadAndRequestSignaturesSigner {
|
|
597
|
+
name: string;
|
|
598
|
+
email?: string;
|
|
599
|
+
whatsapp_phone_number?: string;
|
|
600
|
+
/** PHP SDK compatibility alias for `whatsapp_phone_number`. */
|
|
601
|
+
phone?: string;
|
|
602
|
+
/** Brazilian tax ID (CPF). Non-digits are stripped before sending. */
|
|
603
|
+
cpf?: string;
|
|
604
|
+
metadata?: Record<string, unknown>;
|
|
605
|
+
verification_method?: AssignmentVerificationMethod;
|
|
606
|
+
notification_methods?: AssignmentNotificationMethod[];
|
|
607
|
+
/** Positive sequential signing step, forwarded to the assignment signer reference. */
|
|
608
|
+
step?: number;
|
|
609
|
+
}
|
|
610
|
+
/** Template role definition. */
|
|
611
|
+
export interface ITemplateRole {
|
|
612
|
+
id: string;
|
|
613
|
+
name: string;
|
|
614
|
+
assignment_type?: string;
|
|
615
|
+
created_at?: string;
|
|
616
|
+
updated_at?: string;
|
|
617
|
+
[key: string]: unknown;
|
|
618
|
+
}
|
|
619
|
+
/** One template field placement returned inside a template page. */
|
|
620
|
+
export interface ITemplateField {
|
|
621
|
+
id: string;
|
|
622
|
+
field_id: string;
|
|
623
|
+
role_id: string;
|
|
624
|
+
label: string;
|
|
625
|
+
display_settings: IDisplaySettings | unknown[] | null;
|
|
626
|
+
created_at: string;
|
|
627
|
+
updated_at: string;
|
|
628
|
+
}
|
|
629
|
+
/** One rendered page and its editor/signer field placements. */
|
|
630
|
+
export interface ITemplatePage extends IDocumentPage {
|
|
631
|
+
fields: ITemplateField[];
|
|
632
|
+
}
|
|
633
|
+
/** Template list item (paginated). */
|
|
634
|
+
export interface ITemplateListItem {
|
|
635
|
+
resource?: string;
|
|
636
|
+
id: string;
|
|
637
|
+
name: string;
|
|
638
|
+
document_name?: string | null;
|
|
639
|
+
message?: string | null;
|
|
640
|
+
status: string;
|
|
641
|
+
account_id?: string;
|
|
642
|
+
pages?: ITemplatePage[];
|
|
643
|
+
roles?: ITemplateRole[];
|
|
644
|
+
/** Tags attached to the template itself (inline `{ id, name }` shape). */
|
|
645
|
+
tags?: IInlineTag[];
|
|
646
|
+
/** Tags auto-applied to documents created from this template. */
|
|
647
|
+
default_document_tags?: IInlineTag[];
|
|
648
|
+
created_at: string;
|
|
649
|
+
updated_at?: string;
|
|
650
|
+
}
|
|
651
|
+
export type ITemplateListResponse = PaginatedResult<ITemplateListItem>;
|
|
652
|
+
/** Full template details. */
|
|
653
|
+
export interface ITemplateDetailsResponse {
|
|
654
|
+
resource?: string;
|
|
655
|
+
id: string;
|
|
656
|
+
name: string;
|
|
657
|
+
document_name?: string | null;
|
|
658
|
+
message?: string | null;
|
|
659
|
+
status: string;
|
|
660
|
+
account_id?: string;
|
|
661
|
+
pages?: ITemplatePage[];
|
|
662
|
+
roles?: ITemplateRole[];
|
|
663
|
+
/** Tags attached to the template itself. */
|
|
664
|
+
tags?: IInlineTag[];
|
|
665
|
+
/** Tags auto-applied to every document created from this template. */
|
|
666
|
+
default_document_tags?: IInlineTag[];
|
|
667
|
+
created_at: string;
|
|
668
|
+
updated_at?: string;
|
|
669
|
+
[key: string]: unknown;
|
|
670
|
+
}
|
|
671
|
+
/**
|
|
672
|
+
* Signer assignment for creating a document from a template. `id` is required
|
|
673
|
+
* here; for cost estimation it is optional — see {@link ITemplateCostSigner}.
|
|
674
|
+
*/
|
|
675
|
+
export interface ITemplateSigner {
|
|
676
|
+
role_id: string;
|
|
677
|
+
id: string;
|
|
678
|
+
verification_method?: AssignmentVerificationMethod;
|
|
679
|
+
notification_methods?: AssignmentNotificationMethod[];
|
|
680
|
+
/** Positive integer controlling signing order (see {@link SignerReference}). */
|
|
681
|
+
step?: number;
|
|
682
|
+
}
|
|
683
|
+
/**
|
|
684
|
+
* Signer entry accepted by the template cost-estimation endpoint, where the
|
|
685
|
+
* signer `id` is optional (the docs mark it "not required for cost estimation").
|
|
686
|
+
*/
|
|
687
|
+
export interface ITemplateCostSigner extends Omit<ITemplateSigner, 'id'> {
|
|
688
|
+
id?: string;
|
|
689
|
+
}
|
|
690
|
+
/** One editor field value baked into a generated document. */
|
|
691
|
+
export interface ITemplateEditorField {
|
|
692
|
+
field_id: string;
|
|
693
|
+
value: unknown;
|
|
694
|
+
}
|
|
695
|
+
/** Options for creating a document from a template. */
|
|
696
|
+
export interface ICreateDocumentFromTemplateOptions {
|
|
697
|
+
name?: string;
|
|
698
|
+
message?: string;
|
|
699
|
+
expires_at?: string;
|
|
700
|
+
editor_fields?: ITemplateEditorField[];
|
|
701
|
+
/**
|
|
702
|
+
* Tag names to attach to the new document. Names that don't exist yet are
|
|
703
|
+
* auto-created; the template's default-document-tags are always merged in.
|
|
704
|
+
*/
|
|
705
|
+
tags?: string[];
|
|
706
|
+
}
|
|
707
|
+
/**
|
|
708
|
+
* Item returned by `GET /documents/statuses`.
|
|
709
|
+
*
|
|
710
|
+
* The API uses `code` (the status name); we mirror that field. `description`
|
|
711
|
+
* is documented in the table but is not currently present in the JSON payload.
|
|
712
|
+
*/
|
|
713
|
+
export interface IDocumentStatusInfo {
|
|
714
|
+
code: DocumentStatus | string;
|
|
715
|
+
deletable: boolean;
|
|
716
|
+
description?: string;
|
|
717
|
+
}
|
|
718
|
+
/**
|
|
719
|
+
* Response from `GET /documents/{signatureHash}/verify` (live-verified against
|
|
720
|
+
* the sandbox). Always a `200`: an unknown/unsigned hash comes back with
|
|
721
|
+
* `is_valid: false`, every other field `null` (except `hash`/`verified_at`),
|
|
722
|
+
* and `message` explaining why.
|
|
723
|
+
*/
|
|
724
|
+
export interface IDocumentVerifyResponse {
|
|
725
|
+
hash: string;
|
|
726
|
+
id: string | null;
|
|
727
|
+
status: DocumentStatus | string | null;
|
|
728
|
+
page_count: string | null;
|
|
729
|
+
signer_count: string | null;
|
|
730
|
+
completed_count: number | null;
|
|
731
|
+
completed_at: string | null;
|
|
732
|
+
verified_at: string;
|
|
733
|
+
is_valid: boolean;
|
|
734
|
+
/** Reason when not valid; empty string on success. */
|
|
735
|
+
message: string;
|
|
736
|
+
}
|
|
737
|
+
/** Item returned by `GET /public/documents/{id}`. */
|
|
738
|
+
export interface IPublicDocumentInfo {
|
|
739
|
+
resource?: string;
|
|
740
|
+
id: string;
|
|
741
|
+
account_id: string;
|
|
742
|
+
template_id: string | null;
|
|
743
|
+
name: string;
|
|
744
|
+
status: DocumentStatus | string;
|
|
745
|
+
artifacts: IDocumentArtifacts;
|
|
746
|
+
is_closed: boolean;
|
|
747
|
+
signing_url: string | null;
|
|
748
|
+
decline_reason: string | null;
|
|
749
|
+
declined_by: ISigner | null;
|
|
750
|
+
tags: IInlineTag[];
|
|
751
|
+
assignment: IAssignment | null;
|
|
752
|
+
pages: IDocumentPage[];
|
|
753
|
+
created_at: string;
|
|
754
|
+
updated_at: string;
|
|
755
|
+
/** Live-compatible fields returned by older sandbox deployments. */
|
|
756
|
+
page_count?: string | number;
|
|
757
|
+
created_by?: string;
|
|
758
|
+
}
|
|
759
|
+
/** Channel accepted by the `send-token` endpoint. */
|
|
760
|
+
export type SendTokenChannel = 'email' | 'whatsapp' | string;
|
|
761
|
+
/**
|
|
762
|
+
* Response from `PUT /public/documents/{id}/send-token`.
|
|
763
|
+
*
|
|
764
|
+
* The published body is `{ email }`; the live legacy form may echo the
|
|
765
|
+
* alternate `recipient` + `channel` fields that the SDK also supports.
|
|
766
|
+
*/
|
|
767
|
+
export interface ISendTokenResponse {
|
|
768
|
+
/** Present for the published `{ email }` request form. */
|
|
769
|
+
status?: number;
|
|
770
|
+
/** Present for the published `{ email }` request form. */
|
|
771
|
+
message?: string;
|
|
772
|
+
/** Present for the live-compatible `{ recipient, channel }` request form. */
|
|
773
|
+
document?: IPublicDocumentInfo;
|
|
774
|
+
/** Present for the live-compatible `{ recipient, channel }` request form. */
|
|
775
|
+
channel?: SendTokenChannel;
|
|
776
|
+
/** Present for the live-compatible `{ recipient, channel }` request form. */
|
|
777
|
+
recipient?: string;
|
|
778
|
+
[key: string]: unknown;
|
|
779
|
+
}
|
|
780
|
+
/** Authentication: login response (also returned by social login). */
|
|
781
|
+
export interface IAuthUser {
|
|
782
|
+
id: string;
|
|
783
|
+
name: string;
|
|
784
|
+
email: string;
|
|
785
|
+
telephone?: string | null;
|
|
786
|
+
government_id?: string | null;
|
|
787
|
+
is_email_verified?: boolean;
|
|
788
|
+
has_accepted_terms?: boolean;
|
|
789
|
+
created_at?: string;
|
|
790
|
+
to_be_deleted_at?: string | null;
|
|
791
|
+
}
|
|
792
|
+
export interface IAuthAccount {
|
|
793
|
+
id: string;
|
|
794
|
+
name: string;
|
|
795
|
+
roles: string[];
|
|
796
|
+
is_delete_allowed: boolean;
|
|
797
|
+
created_at: string;
|
|
798
|
+
}
|
|
799
|
+
export interface ILoginResponse {
|
|
800
|
+
access_token: string;
|
|
801
|
+
user: IAuthUser;
|
|
802
|
+
accounts: IAuthAccount[];
|
|
803
|
+
}
|
|
804
|
+
/**
|
|
805
|
+
* `GET /users/self` is documented as a direct user, while the sandbox has also
|
|
806
|
+
* returned the login-style `{ user, accounts }` object. Preserve either shape.
|
|
807
|
+
*/
|
|
808
|
+
export type IUserSelfResponse = IAuthUser | {
|
|
809
|
+
user: IAuthUser;
|
|
810
|
+
accounts: IAuthAccount[];
|
|
811
|
+
};
|
|
812
|
+
export declare const NOTIFICATION_PREFERENCE_CODES: readonly ['DocumentCompleted', 'SignerDeclined', 'DocumentCancelled', 'DocumentAboutToExpire', 'DocumentExpired', 'DocumentExpirationReset', 'DocumentProcessingFailed', 'TemplateProcessingFailed', 'SignerWhatsappFailed'];
|
|
813
|
+
export type NotificationPreferenceCode = (typeof NOTIFICATION_PREFERENCE_CODES)[number];
|
|
814
|
+
export type INotificationPreferences = Record<NotificationPreferenceCode, boolean>;
|
|
815
|
+
export type IUpdateNotificationPreferencesPayload = Partial<INotificationPreferences>;
|
|
816
|
+
/** Authentication: API key payload returned by `POST /users/api-keys`. */
|
|
817
|
+
export interface IApiKeyResponse {
|
|
818
|
+
api_key: string | null;
|
|
819
|
+
}
|
|
820
|
+
/** Authentication: masked API key returned by `GET /users/api-keys` (or null when never generated). */
|
|
821
|
+
export type IMaskedApiKeyResponse = IApiKeyResponse | null;
|
|
822
|
+
/** Field definition object. */
|
|
823
|
+
export interface IFieldDefinition {
|
|
824
|
+
resource?: string;
|
|
825
|
+
id: string;
|
|
826
|
+
name: string;
|
|
827
|
+
type: string;
|
|
828
|
+
regex?: string | null;
|
|
829
|
+
is_pre_defined?: boolean;
|
|
830
|
+
is_active: boolean;
|
|
831
|
+
is_required?: boolean;
|
|
832
|
+
is_standard?: boolean;
|
|
833
|
+
is_read_only?: boolean;
|
|
834
|
+
is_visible?: boolean;
|
|
835
|
+
}
|
|
836
|
+
/** Payload for creating a field definition. */
|
|
837
|
+
export interface ICreateFieldPayload {
|
|
838
|
+
type: string;
|
|
839
|
+
name: string;
|
|
840
|
+
regex?: string;
|
|
841
|
+
is_required?: boolean;
|
|
842
|
+
is_active?: boolean;
|
|
843
|
+
}
|
|
844
|
+
/** Payload for updating a field definition. */
|
|
845
|
+
export interface IUpdateFieldPayload {
|
|
846
|
+
type?: string;
|
|
847
|
+
name?: string;
|
|
848
|
+
regex?: string | null;
|
|
849
|
+
is_required?: boolean;
|
|
850
|
+
is_active?: boolean;
|
|
851
|
+
}
|
|
852
|
+
/** Field type description returned by `GET /field-types`. */
|
|
853
|
+
export interface IFieldType {
|
|
854
|
+
type: string;
|
|
855
|
+
name: string;
|
|
856
|
+
}
|
|
857
|
+
/** Single result returned by `POST /accounts/{id}/fields/{id}/validate`. */
|
|
858
|
+
export interface IFieldValidationResult {
|
|
859
|
+
type?: string;
|
|
860
|
+
field_id?: string;
|
|
861
|
+
success: boolean;
|
|
862
|
+
error_message: string;
|
|
863
|
+
}
|
|
864
|
+
/** Payload entry for `POST /accounts/{id}/fields/validate-multiple`. */
|
|
865
|
+
export interface IFieldValidateMultipleEntry {
|
|
866
|
+
field_id: string;
|
|
867
|
+
value: unknown;
|
|
868
|
+
}
|
|
869
|
+
/** Item returned by `GET /documents/{id}/assignments/{id}/whatsapp-notifications`. */
|
|
870
|
+
export interface IWhatsAppNotification {
|
|
871
|
+
sent_at: number;
|
|
872
|
+
header: string;
|
|
873
|
+
body: string;
|
|
874
|
+
buttons: Array<{
|
|
875
|
+
text: string;
|
|
876
|
+
url?: string;
|
|
877
|
+
}>;
|
|
878
|
+
phone_number: string;
|
|
879
|
+
signer_id: string;
|
|
880
|
+
}
|
|
881
|
+
/** Body entry for the signer-side `POST /documents/{id}/assignments/{id}` sign endpoint. */
|
|
882
|
+
export interface ISignFieldEntry {
|
|
883
|
+
itemId: string;
|
|
884
|
+
fieldId: string;
|
|
885
|
+
pageId: string;
|
|
886
|
+
value: string;
|
|
887
|
+
}
|
|
888
|
+
/**
|
|
889
|
+
* Workspace tag object. Tag names are unique per workspace (case-insensitive)
|
|
890
|
+
* and `color` is an optional 6-char hex string (without the leading `#`).
|
|
891
|
+
*/
|
|
892
|
+
export interface ITag {
|
|
893
|
+
resource?: string;
|
|
894
|
+
id: string;
|
|
895
|
+
name: string;
|
|
896
|
+
color: string | null;
|
|
897
|
+
created_at: string;
|
|
898
|
+
updated_at: string;
|
|
899
|
+
}
|
|
900
|
+
/** Inline tag shape embedded inside documents/templates (`{ id, name, color? }`). */
|
|
901
|
+
export interface IInlineTag {
|
|
902
|
+
id: string;
|
|
903
|
+
name: string;
|
|
904
|
+
color?: string | null;
|
|
905
|
+
}
|
|
906
|
+
/** Payload for `POST /accounts/{id}/tags`. */
|
|
907
|
+
export interface ICreateTagPayload {
|
|
908
|
+
name: string;
|
|
909
|
+
/** 6-char hex color, with or without a leading `#`. Omit/`null` for none. */
|
|
910
|
+
color?: string | null;
|
|
911
|
+
}
|
|
912
|
+
/** Payload for `PUT /accounts/{id}/tags/{id}`. Omit a field to leave it unchanged. */
|
|
913
|
+
export interface IUpdateTagPayload {
|
|
914
|
+
name?: string;
|
|
915
|
+
/** Pass `null` to clear the color; omit to leave unchanged. */
|
|
916
|
+
color?: string | null;
|
|
917
|
+
}
|
|
918
|
+
/** Confirmation returned after detaching a tag from a document. */
|
|
919
|
+
export interface IDetachTagResponse {
|
|
920
|
+
detached: boolean;
|
|
921
|
+
}
|
|
922
|
+
/** Confirmation returned after deleting a tag. */
|
|
923
|
+
export interface IDeleteTagResponse {
|
|
924
|
+
deleted: boolean;
|
|
925
|
+
}
|
|
926
|
+
//# sourceMappingURL=types.d.ts.map
|