@outseta/api-client 0.3.24 → 0.3.25
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
|
@@ -536,6 +536,7 @@ export * from './planWebhookEntityPlanAddOnsItemAddOn';
|
|
|
536
536
|
export * from './planWebhookEntityPlanAddOnsItemAddOnBillingAddOnType';
|
|
537
537
|
export * from './planWebhookEntityPlanFamily';
|
|
538
538
|
export * from './processCodePayload';
|
|
539
|
+
export * from './publicEmailListAddSubscriptionBody';
|
|
539
540
|
export * from './qcount';
|
|
540
541
|
export * from './qcountAllOf';
|
|
541
542
|
export * from './qcountConfig';
|
|
@@ -4,6 +4,7 @@ import type {
|
|
|
4
4
|
AuthResendTwoFactorParams,
|
|
5
5
|
AuthSwitchTwoFactorMechanismParams,
|
|
6
6
|
AuthVerifyTwoFactorRecoveryParams,
|
|
7
|
+
PublicEmailListAddSubscriptionBody,
|
|
7
8
|
TokenPayload,
|
|
8
9
|
TokenTwoFactorEnrollmentBeginEmailParams,
|
|
9
10
|
TokenTwoFactorEnrollmentBeginTotpParams,
|
|
@@ -17,6 +18,84 @@ import type {
|
|
|
17
18
|
|
|
18
19
|
import { customFetch } from '../../client';
|
|
19
20
|
|
|
21
|
+
// https://stackoverflow.com/questions/49579094/typescript-conditional-types-filter-out-readonly-properties-pick-only-requir/49579497#49579497
|
|
22
|
+
type IfEquals<X, Y, A = X, B = never> = (<T>() => T extends X ? 1 : 2) extends <
|
|
23
|
+
T,
|
|
24
|
+
>() => T extends Y ? 1 : 2
|
|
25
|
+
? A
|
|
26
|
+
: B;
|
|
27
|
+
|
|
28
|
+
type WritableKeys<T> = {
|
|
29
|
+
[P in keyof T]-?: IfEquals<
|
|
30
|
+
{ [Q in P]: T[P] },
|
|
31
|
+
{ -readonly [Q in P]: T[P] },
|
|
32
|
+
P
|
|
33
|
+
>;
|
|
34
|
+
}[keyof T];
|
|
35
|
+
|
|
36
|
+
type UnionToIntersection<U> =
|
|
37
|
+
(U extends any ? (k: U)=>void : never) extends ((k: infer I)=>void) ? I : never;
|
|
38
|
+
type DistributeReadOnlyOverUnions<T> = T extends any ? NonReadonly<T> : never;
|
|
39
|
+
|
|
40
|
+
type Writable<T> = Pick<T, WritableKeys<T>>;
|
|
41
|
+
type NonReadonly<T> = [T] extends [UnionToIntersection<T>] ? {
|
|
42
|
+
[P in keyof Writable<T>]: T[P] extends object
|
|
43
|
+
? NonReadonly<NonNullable<T[P]>>
|
|
44
|
+
: T[P];
|
|
45
|
+
} : DistributeReadOnlyOverUnions<T>;
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* This endpoint does not require authentication. The email list must be public, and the
|
|
50
|
+
subscription is subject to bot protection and the list's double opt-in settings.
|
|
51
|
+
* @summary Publicly subscribe a person to an email list.
|
|
52
|
+
*/
|
|
53
|
+
export type publicEmailListAddSubscriptionResponse200 = {
|
|
54
|
+
data: Blob
|
|
55
|
+
status: 200
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export type publicEmailListAddSubscriptionResponse400 = {
|
|
59
|
+
data: void
|
|
60
|
+
status: 400
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export type publicEmailListAddSubscriptionResponse404 = {
|
|
64
|
+
data: void
|
|
65
|
+
status: 404
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export type publicEmailListAddSubscriptionResponseSuccess = (publicEmailListAddSubscriptionResponse200) & {
|
|
69
|
+
headers: Headers;
|
|
70
|
+
};
|
|
71
|
+
export type publicEmailListAddSubscriptionResponseError = (publicEmailListAddSubscriptionResponse400 | publicEmailListAddSubscriptionResponse404) & {
|
|
72
|
+
headers: Headers;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export type publicEmailListAddSubscriptionResponse = (publicEmailListAddSubscriptionResponseSuccess | publicEmailListAddSubscriptionResponseError)
|
|
76
|
+
|
|
77
|
+
export const getPublicEmailListAddSubscriptionUrl = (emailListUid: string | null,) => {
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
return `/api/v1/public/email/lists/${emailListUid}/subscriptions`
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export const publicEmailListAddSubscription = async (emailListUid: string | null,
|
|
86
|
+
publicEmailListAddSubscriptionBody: NonReadonly<PublicEmailListAddSubscriptionBody>, options?: RequestInit): Promise<publicEmailListAddSubscriptionResponse> => {
|
|
87
|
+
|
|
88
|
+
return customFetch<publicEmailListAddSubscriptionResponse>(getPublicEmailListAddSubscriptionUrl(emailListUid),
|
|
89
|
+
{
|
|
90
|
+
...options,
|
|
91
|
+
method: 'POST',
|
|
92
|
+
headers: { 'Content-Type': 'application/json', ...options?.headers },
|
|
93
|
+
body: JSON.stringify(
|
|
94
|
+
publicEmailListAddSubscriptionBody,)
|
|
95
|
+
}
|
|
96
|
+
);}
|
|
97
|
+
|
|
98
|
+
|
|
20
99
|
/**
|
|
21
100
|
* Authenticates a user and returns a JWT access token (plus a refresh token).
|
|
22
101
|
|