@outseta/api-client 0.4.2 → 0.4.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@outseta/api-client",
3
- "version": "0.4.2",
3
+ "version": "0.4.3",
4
4
  "description": "Generated API client for the Outseta REST API",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -819,6 +819,8 @@ export * from './templateEmailInstanceAllOfRecipient';
819
819
  export * from './templateEmailInstanceAllOfTemplate';
820
820
  export * from './templateGetAllTemplateEmails200';
821
821
  export * from './templateGetAllTemplateEmailsParams';
822
+ export * from './templateGetAllTemplates200';
823
+ export * from './templateGetAllTemplatesParams';
822
824
  export * from './templateGetTemplateEmails200';
823
825
  export * from './templateGetTemplateEmailsParams';
824
826
  export * from './templateSendTemplateEmailBody';
@@ -843,6 +845,7 @@ export * from './twoFactorTotpEnrollmentPayload';
843
845
  export * from './twoFactorVerifyRequest';
844
846
  export * from './updateAccountMemberRoleModel';
845
847
  export * from './updateAccountMemberRoleModelRole';
848
+ export * from './updateTemplateRequest';
846
849
  export * from './usage';
847
850
  export * from './usageAddUsageBody';
848
851
  export * from './usageAllOf';
@@ -0,0 +1,8 @@
1
+ // @ts-nocheck
2
+ import type { CollectionMetadata } from './collectionMetadata';
3
+ import type { Template } from './template';
4
+
5
+ export type TemplateGetAllTemplates200 = {
6
+ metadata?: CollectionMetadata;
7
+ items?: Template[];
8
+ };
@@ -0,0 +1,14 @@
1
+ // @ts-nocheck
2
+ import type { LimitParameter } from './limitParameter';
3
+ import type { OffsetParameter } from './offsetParameter';
4
+
5
+ export type TemplateGetAllTemplatesParams = {
6
+ /**
7
+ * Requested page size. The server caps it at 100, or 25 when requested fields expand child objects or require additional queries; metadata.limit reports the applied value. Use offset=1 for the second page.
8
+ */
9
+ limit?: LimitParameter;
10
+ /**
11
+ * Zero-based page number, not a record offset. With limit=50, the second page is offset=1; offset=50 is page index 50 (records 2501-2550).
12
+ */
13
+ offset?: OffsetParameter;
14
+ };
@@ -0,0 +1,30 @@
1
+ // @ts-nocheck
2
+
3
+ /**
4
+ * The fields of an email template that an update may change. Every field is optional:
5
+ a field left out keeps its current value.
6
+ */
7
+ export interface UpdateTemplateRequest {
8
+ /** The HTML of the template. May use Liquid tokens, for example {{ Person.FirstName }},
9
+ and must keep every token in the template's RequiredTokens. Cannot be null. */
10
+ Body?: string;
11
+ /**
12
+ * What the template is for. Cannot be changed for a system email.
13
+ * @nullable
14
+ */
15
+ Description?: string | null;
16
+ /**
17
+ * The design of the template in the drag-and-drop editor, as JSON. Send null with a new
18
+ Body so the editor opens the new Body as HTML instead of the old design.
19
+ * @nullable
20
+ */
21
+ Design?: string | null;
22
+ /** The name of the template, shown in the Outseta app. Cannot be changed for a system
23
+ email. Cannot be null. */
24
+ Name?: string;
25
+ /**
26
+ * The subject line of the email. May use Liquid tokens, for example {{ CompanyName }}.
27
+ * @nullable
28
+ */
29
+ Subject?: string | null;
30
+ }
@@ -1,15 +1,84 @@
1
1
  // @ts-nocheck
2
2
  import type {
3
+ Template,
3
4
  TemplateEmailInstance,
4
5
  TemplateGetAllTemplateEmails200,
5
6
  TemplateGetAllTemplateEmailsParams,
7
+ TemplateGetAllTemplates200,
8
+ TemplateGetAllTemplatesParams,
6
9
  TemplateGetTemplateEmails200,
7
10
  TemplateGetTemplateEmailsParams,
8
- TemplateSendTemplateEmailBody
11
+ TemplateSendTemplateEmailBody,
12
+ UpdateTemplateRequest
9
13
  } from '.././models';
10
14
 
11
15
  import { customFetch } from '../../client';
12
16
 
17
+ /**
18
+ * The list holds the templates from Email > Email templates (Tag template), the email
19
+ layouts (Tag layout), the broadcast wrapper (Tag wrapper), the saved support replies
20
+ (Tag savedReply) and the system emails Outseta sends, such as the registration
21
+ confirmation (Tag email). A system email has a SystemName, which never changes. Filter
22
+ with Tag=email or SystemName to find one.
23
+
24
+ Body and Design are left out to keep the list small, except that a system email the
25
+ account never edited carries its default Body. Read a template with the get endpoint to
26
+ see its Body and Design.
27
+
28
+ A system email the account never edited is not stored yet. It is listed with a Uid
29
+ that starts with int_, which can be used like any other Uid. Saving the system email
30
+ stores the account's own copy, which has a regular Uid from then on. An int_ Uid can
31
+ change when Outseta adds system emails, so keep the SystemName rather than the int_ Uid.
32
+
33
+ Internal system emails that accounts cannot change are not listed.
34
+ * @summary The email templates, layouts and system emails of the account.
35
+ */
36
+ export type templateGetAllTemplatesResponse200 = {
37
+ data: TemplateGetAllTemplates200
38
+ status: 200
39
+ }
40
+
41
+ export type templateGetAllTemplatesResponse401 = {
42
+ data: void
43
+ status: 401
44
+ }
45
+
46
+ export type templateGetAllTemplatesResponseSuccess = (templateGetAllTemplatesResponse200) & {
47
+ headers: Headers;
48
+ };
49
+ export type templateGetAllTemplatesResponseError = (templateGetAllTemplatesResponse401) & {
50
+ headers: Headers;
51
+ };
52
+
53
+ export type templateGetAllTemplatesResponse = (templateGetAllTemplatesResponseSuccess | templateGetAllTemplatesResponseError)
54
+
55
+ export const getTemplateGetAllTemplatesUrl = (params?: TemplateGetAllTemplatesParams,) => {
56
+ const normalizedParams = new URLSearchParams();
57
+
58
+ Object.entries(params || {}).forEach(([key, value]) => {
59
+
60
+ if (value !== undefined) {
61
+ normalizedParams.append(key, value === null ? 'null' : value.toString())
62
+ }
63
+ });
64
+
65
+ const stringifiedParams = normalizedParams.toString();
66
+
67
+ return stringifiedParams.length > 0 ? `/api/v1/templates?${stringifiedParams}` : `/api/v1/templates`
68
+ }
69
+
70
+ export const templateGetAllTemplates = async (params?: TemplateGetAllTemplatesParams, options?: RequestInit): Promise<templateGetAllTemplatesResponse> => {
71
+
72
+ return customFetch<templateGetAllTemplatesResponse>(getTemplateGetAllTemplatesUrl(params),
73
+ {
74
+ ...options,
75
+ method: 'GET'
76
+
77
+
78
+ }
79
+ );}
80
+
81
+
13
82
  /**
14
83
  * Filter with personUid to see what one person was sent, or with templateUid to
15
84
  restrict the results to a single template.
@@ -124,6 +193,144 @@ export const templateGetTemplateEmails = async (templateUid: string | null,
124
193
  );}
125
194
 
126
195
 
196
+ /**
197
+ * Body is the HTML of the email; Subject and Body may use Liquid tokens such as
198
+ {{ Person.FirstName }}. AvailableTokens lists the tokens Outseta fills in for a system
199
+ email, and RequiredTokens the ones its Body must keep (for example ConfirmationUrl in the
200
+ registration confirmation).
201
+
202
+ Design is the drag-and-drop editor's design of the template as JSON, or null for a
203
+ template that is plain HTML. System emails have no Design.
204
+
205
+ A system email the account never edited returns its default content under its int_ Uid
206
+ from the list endpoint.
207
+ * @summary Get an email template, layout or system email, with its Body and Design.
208
+ */
209
+ export type templateGetTemplateResponse200 = {
210
+ data: Template
211
+ status: 200
212
+ }
213
+
214
+ export type templateGetTemplateResponse400 = {
215
+ data: void
216
+ status: 400
217
+ }
218
+
219
+ export type templateGetTemplateResponse401 = {
220
+ data: void
221
+ status: 401
222
+ }
223
+
224
+ export type templateGetTemplateResponse404 = {
225
+ data: void
226
+ status: 404
227
+ }
228
+
229
+ export type templateGetTemplateResponseSuccess = (templateGetTemplateResponse200) & {
230
+ headers: Headers;
231
+ };
232
+ export type templateGetTemplateResponseError = (templateGetTemplateResponse400 | templateGetTemplateResponse401 | templateGetTemplateResponse404) & {
233
+ headers: Headers;
234
+ };
235
+
236
+ export type templateGetTemplateResponse = (templateGetTemplateResponseSuccess | templateGetTemplateResponseError)
237
+
238
+ export const getTemplateGetTemplateUrl = (templateUid: string | null,) => {
239
+
240
+
241
+
242
+
243
+ return `/api/v1/templates/${templateUid}`
244
+ }
245
+
246
+ export const templateGetTemplate = async (templateUid: string | null, options?: RequestInit): Promise<templateGetTemplateResponse> => {
247
+
248
+ return customFetch<templateGetTemplateResponse>(getTemplateGetTemplateUrl(templateUid),
249
+ {
250
+ ...options,
251
+ method: 'GET'
252
+
253
+
254
+ }
255
+ );}
256
+
257
+
258
+ /**
259
+ * Send only the fields to change, usually Subject and Body. Fields left out of the request
260
+ keep their current values; a field sent as null is cleared. The Uid in the request body
261
+ is ignored.
262
+
263
+ Subject and Body must be valid Liquid, and Body must keep every token in RequiredTokens
264
+ (for example ConfirmationUrl in the registration confirmation); otherwise the update is
265
+ rejected with a validation error. The Name, Description and SystemName of a system email
266
+ cannot be changed.
267
+
268
+ A template with a Design (made in the drag-and-drop editor of Email > Email templates)
269
+ opens in the editor from its Design, not its Body. To change the Body of such a
270
+ template, send Design as null as well: the editor then opens the new Body as HTML.
271
+ Otherwise the editor keeps showing the old design, and saving the template there
272
+ replaces the new Body. System emails have no Design.
273
+
274
+ A system email the account never edited has a Uid that starts with int_. Updating it
275
+ stores the account's own copy, with the default content for the fields left out, and
276
+ returns it with its new Uid. From then on Outseta sends the copy; the int_ Uid
277
+ returns 404.
278
+
279
+ On an Outseta account that is not verified yet, updating a system email pauses all email
280
+ sending of the account, as it does in the Outseta app.
281
+ * @summary Update an email template, layout or system email.
282
+ */
283
+ export type templateUpdateTemplateResponse200 = {
284
+ data: Template
285
+ status: 200
286
+ }
287
+
288
+ export type templateUpdateTemplateResponse400 = {
289
+ data: void
290
+ status: 400
291
+ }
292
+
293
+ export type templateUpdateTemplateResponse401 = {
294
+ data: void
295
+ status: 401
296
+ }
297
+
298
+ export type templateUpdateTemplateResponse404 = {
299
+ data: void
300
+ status: 404
301
+ }
302
+
303
+ export type templateUpdateTemplateResponseSuccess = (templateUpdateTemplateResponse200) & {
304
+ headers: Headers;
305
+ };
306
+ export type templateUpdateTemplateResponseError = (templateUpdateTemplateResponse400 | templateUpdateTemplateResponse401 | templateUpdateTemplateResponse404) & {
307
+ headers: Headers;
308
+ };
309
+
310
+ export type templateUpdateTemplateResponse = (templateUpdateTemplateResponseSuccess | templateUpdateTemplateResponseError)
311
+
312
+ export const getTemplateUpdateTemplateUrl = (templateUid: string | null,) => {
313
+
314
+
315
+
316
+
317
+ return `/api/v1/templates/${templateUid}`
318
+ }
319
+
320
+ export const templateUpdateTemplate = async (templateUid: string | null,
321
+ updateTemplateRequest: UpdateTemplateRequest, options?: RequestInit): Promise<templateUpdateTemplateResponse> => {
322
+
323
+ return customFetch<templateUpdateTemplateResponse>(getTemplateUpdateTemplateUrl(templateUid),
324
+ {
325
+ ...options,
326
+ method: 'PUT',
327
+ headers: { 'Content-Type': 'application/json', ...options?.headers },
328
+ body: JSON.stringify(
329
+ updateTemplateRequest,)
330
+ }
331
+ );}
332
+
333
+
127
334
  /**
128
335
  * The email is merge-rendered for the person and sent immediately. No broadcast
129
336
  is created. People who have bounced, unsubscribed or reported spam are not sent