@isnap/sdk 1.3.0 → 1.4.0-next.203
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/CHANGELOG.md +10 -0
- package/README.md +1 -1
- package/dist/client.d.ts +2 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +3 -0
- package/dist/client.js.map +1 -1
- package/dist/generated/openapi.d.ts +1784 -346
- package/dist/index.d.ts +5 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/resources/apps.d.ts +11 -4
- package/dist/resources/apps.d.ts.map +1 -1
- package/dist/resources/apps.js +11 -4
- package/dist/resources/apps.js.map +1 -1
- package/dist/resources/lines.d.ts +206 -6
- package/dist/resources/lines.d.ts.map +1 -1
- package/dist/resources/lines.js +215 -6
- package/dist/resources/lines.js.map +1 -1
- package/dist/resources/macos-sessions.d.ts +48 -0
- package/dist/resources/macos-sessions.d.ts.map +1 -0
- package/dist/resources/macos-sessions.js +51 -0
- package/dist/resources/macos-sessions.js.map +1 -0
- package/dist/resources/preorders.d.ts +19 -7
- package/dist/resources/preorders.d.ts.map +1 -1
- package/dist/resources/preorders.js +19 -7
- package/dist/resources/preorders.js.map +1 -1
- package/dist/resources/webhooks.d.ts +1 -1
- package/dist/resources/webhooks.js +1 -1
- package/dist/version.d.ts +2 -2
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +13 -5
- package/dist/version.js.map +1 -1
- package/dist/webhooks/types.d.ts +46 -3
- package/dist/webhooks/types.d.ts.map +1 -1
- package/dist/webhooks/types.js +3 -0
- package/dist/webhooks/types.js.map +1 -1
- package/dist/webhooks/verify.d.ts +22 -9
- package/dist/webhooks/verify.d.ts.map +1 -1
- package/dist/webhooks/verify.js +101 -29
- package/dist/webhooks/verify.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export { ByodResource } from './resources/byod.js';
|
|
|
13
13
|
export { ChatsResource } from './resources/chats.js';
|
|
14
14
|
export { LinesResource } from './resources/lines.js';
|
|
15
15
|
export { LookupResource } from './resources/lookup.js';
|
|
16
|
+
export { MacosSessionsResource } from './resources/macos-sessions.js';
|
|
16
17
|
export { MessagesResource } from './resources/messages.js';
|
|
17
18
|
export { PreOrdersResource } from './resources/preorders.js';
|
|
18
19
|
export { TrialResource } from './resources/trial.js';
|
|
@@ -20,8 +21,9 @@ export { WebhooksResource } from './resources/webhooks.js';
|
|
|
20
21
|
export type { AppDownloadEntry, AppManifest } from './resources/apps.js';
|
|
21
22
|
export type { AreaCode, AreaCodes, Country, ListAreaCodesQuery } from './resources/area-codes.js';
|
|
22
23
|
export type { Chat, ChatMarkRead, ChatTypingStart, ChatTypingStop, ListChatsQuery, MarkReadBody, ShareContactCardBody, ShareContactCardResult, TypingStartBody } from './resources/chats.js';
|
|
23
|
-
export type { ActivateLineBody, AssignLineBody, Line, LineConfigPatch, LineConfigResponseData, LineHealth, LineList, ListLinesQuery, ListQueueQuery, MintSharedLineBody, MyLines, PatchLineBody, QueueResponseData, QuotaSnapshot, TransferOwnershipBody } from './resources/lines.js';
|
|
24
|
+
export type { ActivateLineBody, AssignLineBody, Line, LineConfigPatch, LineConfigResponseData, LineHealth, LineList, ListLinesQuery, ListQueueQuery, MintSharedLineBody, MyLines, PatchLineBody, QueueResponseData, QuotaSnapshot, SetLineAnniversaryBody, SetLineVariantBody, TerminateLineBody, TransferOwnershipBody } from './resources/lines.js';
|
|
24
25
|
export type { LookupRequest, LookupResult } from './resources/lookup.js';
|
|
26
|
+
export type { MacosSession } from './resources/macos-sessions.js';
|
|
25
27
|
export type { ListMessagesQuery, Message, Reaction, ReactionRemoval, ReactionType, SendMessageBody, SendReactionBody } from './resources/messages.js';
|
|
26
28
|
export type { Attachment, CreateAttachmentBody, CreateAttachmentResponse, UploadInput, UploadMetadata, UploadOptions } from './resources/attachments.js';
|
|
27
29
|
export type { ByodPairBody, ByodPairResponse } from './resources/byod.js';
|
|
@@ -31,6 +33,6 @@ export type { CreateWebhookBody, ListDeliveriesQuery, ListEventsQuery, UpdateWeb
|
|
|
31
33
|
export { parseWebhookEvent } from './webhooks/parse.js';
|
|
32
34
|
export { verifyWebhook } from './webhooks/verify.js';
|
|
33
35
|
export type { VerifyWebhookOptions } from './webhooks/verify.js';
|
|
34
|
-
export { isAdminEvent, isBindingEvent, isLineEvent, isMessageEvent, isPreOrderEvent, isReactionEvent, isTrialEvent, isTypingIndicatorEvent } from './webhooks/types.js';
|
|
35
|
-
export type { AdminEvent, AdminEventType, BindingEvent, BindingEventType, LineEvent, LineEventType, MessageEvent, MessageEventType, PreOrderEvent, PreOrderEventType, ReactionEvent, ReactionEventData, ReactionEventType, TrialEvent, TrialEventType, TypingIndicatorEvent, TypingIndicatorEventType, WebhookEvent, WebhookEventBase } from './webhooks/types.js';
|
|
36
|
+
export { isAdminEvent, isBindingEvent, isLineEvent, isMacosSessionEvent, isMessageEvent, isPreOrderEvent, isReactionEvent, isTrialEvent, isTypingIndicatorEvent } from './webhooks/types.js';
|
|
37
|
+
export type { AdminEvent, AdminEventType, BindingEvent, BindingEventType, LineEvent, LineEventType, MacosSessionEvent, MacosSessionEventType, MessageEvent, MessageEventType, PreOrderEvent, PreOrderEventType, ReactionEvent, ReactionEventData, ReactionEventType, TrialEvent, TrialEventType, TypingIndicatorEvent, TypingIndicatorEventType, WebhookEvent, WebhookEventBase } from './webhooks/types.js';
|
|
36
38
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AACzC,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAC5D,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,EAAE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A"}
|
package/dist/index.js
CHANGED
|
@@ -8,11 +8,12 @@ export { ByodResource } from './resources/byod.js';
|
|
|
8
8
|
export { ChatsResource } from './resources/chats.js';
|
|
9
9
|
export { LinesResource } from './resources/lines.js';
|
|
10
10
|
export { LookupResource } from './resources/lookup.js';
|
|
11
|
+
export { MacosSessionsResource } from './resources/macos-sessions.js';
|
|
11
12
|
export { MessagesResource } from './resources/messages.js';
|
|
12
13
|
export { PreOrdersResource } from './resources/preorders.js';
|
|
13
14
|
export { TrialResource } from './resources/trial.js';
|
|
14
15
|
export { WebhooksResource } from './resources/webhooks.js';
|
|
15
16
|
export { parseWebhookEvent } from './webhooks/parse.js';
|
|
16
17
|
export { verifyWebhook } from './webhooks/verify.js';
|
|
17
|
-
export { isAdminEvent, isBindingEvent, isLineEvent, isMessageEvent, isPreOrderEvent, isReactionEvent, isTrialEvent, isTypingIndicatorEvent } from './webhooks/types.js';
|
|
18
|
+
export { isAdminEvent, isBindingEvent, isLineEvent, isMacosSessionEvent, isMessageEvent, isPreOrderEvent, isReactionEvent, isTrialEvent, isTypingIndicatorEvent } from './webhooks/types.js';
|
|
18
19
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAGzC,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC3D,OAAO,EACL,kBAAkB,EAClB,QAAQ,EACR,mBAAmB,EACnB,eAAe,EACf,aAAa,EACb,SAAS,EACT,mBAAmB,EACnB,aAAa,EACb,oBAAoB,EACpB,qBAAqB,EACrB,kBAAkB,EAClB,cAAc,EACd,uBAAuB,EACvB,wBAAwB,EACxB,qBAAqB,EACtB,MAAM,aAAa,CAAA;AAKpB,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;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AsB,CAAA;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAA;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAsF1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAEpD,OAAO,EACL,YAAY,EACZ,cAAc,EACd,WAAW,EACX,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,eAAe,EACf,YAAY,EACZ,sBAAsB,EACvB,MAAM,qBAAqB,CAAA"}
|
package/dist/resources/apps.d.ts
CHANGED
|
@@ -6,15 +6,22 @@ export type AppDownloadEntry = components['schemas']['AppDownloadEntry'];
|
|
|
6
6
|
export declare class AppsResource extends BaseResource {
|
|
7
7
|
/**
|
|
8
8
|
* `GET /v1/apps` — the app/bridge download manifest: per-platform installer
|
|
9
|
-
* URL, the
|
|
10
|
-
* artifact configured for
|
|
9
|
+
* URL, the version currently published for that platform, and whether this
|
|
10
|
+
* deployment has an artifact configured for it. Public (no auth) and, unlike
|
|
11
11
|
* `byod.pair`, requires no pairing in flight — use it for setup guides,
|
|
12
12
|
* "add a device" flows, reinstalls, and update prompts (compare `version`
|
|
13
13
|
* against the version the device reports).
|
|
14
14
|
*
|
|
15
15
|
* The URLs are the same stable redirects `byod.pair` returns in
|
|
16
|
-
* `download_urls
|
|
17
|
-
*
|
|
16
|
+
* `download_urls` — one builder server-side, so they cannot drift.
|
|
17
|
+
*
|
|
18
|
+
* `version` is `string | null`. It is read from the release feed beside the
|
|
19
|
+
* artifact `url` resolves to, so the number and the file cannot name
|
|
20
|
+
* different releases, and it is `null` when that feed publishes nothing.
|
|
21
|
+
* Render the absence ("version not published"); never substitute a number,
|
|
22
|
+
* and do not treat `null` as an error. It is deliberately NOT the
|
|
23
|
+
* `bridge_version` string `byod.pair` returns — that field is a separate,
|
|
24
|
+
* device-facing value (WHA-2538).
|
|
18
25
|
*
|
|
19
26
|
* A platform with `available: false` still appears in the response; hide the
|
|
20
27
|
* affordance rather than offering a link that 404s on click.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apps.d.ts","sourceRoot":"","sources":["../../src/resources/apps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAExC,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,qBAAqB,CAAC,CAAA;AACtE,MAAM,MAAM,gBAAgB,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAA;AAExE,qBAAa,YAAa,SAAQ,YAAY;IAC5C
|
|
1
|
+
{"version":3,"file":"apps.d.ts","sourceRoot":"","sources":["../../src/resources/apps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAExC,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,qBAAqB,CAAC,CAAA;AACtE,MAAM,MAAM,gBAAgB,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAA;AAExE,qBAAa,YAAa,SAAQ,YAAY;IAC5C;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,WAAW,CAAC;CAGtD"}
|
package/dist/resources/apps.js
CHANGED
|
@@ -2,15 +2,22 @@ import { BaseResource } from './base.js';
|
|
|
2
2
|
export class AppsResource extends BaseResource {
|
|
3
3
|
/**
|
|
4
4
|
* `GET /v1/apps` — the app/bridge download manifest: per-platform installer
|
|
5
|
-
* URL, the
|
|
6
|
-
* artifact configured for
|
|
5
|
+
* URL, the version currently published for that platform, and whether this
|
|
6
|
+
* deployment has an artifact configured for it. Public (no auth) and, unlike
|
|
7
7
|
* `byod.pair`, requires no pairing in flight — use it for setup guides,
|
|
8
8
|
* "add a device" flows, reinstalls, and update prompts (compare `version`
|
|
9
9
|
* against the version the device reports).
|
|
10
10
|
*
|
|
11
11
|
* The URLs are the same stable redirects `byod.pair` returns in
|
|
12
|
-
* `download_urls
|
|
13
|
-
*
|
|
12
|
+
* `download_urls` — one builder server-side, so they cannot drift.
|
|
13
|
+
*
|
|
14
|
+
* `version` is `string | null`. It is read from the release feed beside the
|
|
15
|
+
* artifact `url` resolves to, so the number and the file cannot name
|
|
16
|
+
* different releases, and it is `null` when that feed publishes nothing.
|
|
17
|
+
* Render the absence ("version not published"); never substitute a number,
|
|
18
|
+
* and do not treat `null` as an error. It is deliberately NOT the
|
|
19
|
+
* `bridge_version` string `byod.pair` returns — that field is a separate,
|
|
20
|
+
* device-facing value (WHA-2538).
|
|
14
21
|
*
|
|
15
22
|
* A platform with `available: false` still appears in the response; hide the
|
|
16
23
|
* affordance rather than offering a link that 404s on click.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apps.js","sourceRoot":"","sources":["../../src/resources/apps.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAKxC,MAAM,OAAO,YAAa,SAAQ,YAAY;IAC5C
|
|
1
|
+
{"version":3,"file":"apps.js","sourceRoot":"","sources":["../../src/resources/apps.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAKxC,MAAM,OAAO,YAAa,SAAQ,YAAY;IAC5C;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,QAAQ,CAAC,IAAqB;QAC5B,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAc,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,IAAI,CAAC,CAAA;IAC7E,CAAC;CACF"}
|
|
@@ -9,6 +9,9 @@ export type ActivateLineBody = components['schemas']['ActivateLine'];
|
|
|
9
9
|
export type TransferOwnershipBody = components['schemas']['TransferOwnership'];
|
|
10
10
|
export type PatchLineBody = components['schemas']['PatchLine'];
|
|
11
11
|
export type MintSharedLineBody = components['schemas']['MintSharedLine'];
|
|
12
|
+
export type TerminateLineBody = components['schemas']['TerminateLine'];
|
|
13
|
+
export type SetLineAnniversaryBody = components['schemas']['SetLineAnniversary'];
|
|
14
|
+
export type SetLineVariantBody = components['schemas']['SetLineVariant'];
|
|
12
15
|
export type LineConfigPatch = components['schemas']['LineConfigPatch'];
|
|
13
16
|
export type LineConfigResponseData = components['schemas']['LineConfigResponseData'];
|
|
14
17
|
export type LineHealth = components['schemas']['LineHealth'];
|
|
@@ -56,14 +59,108 @@ export declare class LinesResource extends BaseResource {
|
|
|
56
59
|
reserve(id: string, opts?: RequestOptions): Promise<Line>;
|
|
57
60
|
/**
|
|
58
61
|
* `POST /v1/lines/{id}/activate` — commit a reserved line to `active`.
|
|
59
|
-
* Wholesale partners
|
|
60
|
-
* Stripe checkout, EOM-metered)
|
|
61
|
-
* via `body.inbound_only`. Direct
|
|
62
|
-
*
|
|
62
|
+
* **Wholesale partners only**: the second phase of reserve→activate (no
|
|
63
|
+
* Stripe checkout, EOM-metered), which may pick the inbound-only rental
|
|
64
|
+
* variant via `body.inbound_only`. Direct customers get `402
|
|
65
|
+
* checkout_required` — their line activates when the Stripe Checkout session
|
|
66
|
+
* from `billing.checkout()` is paid, and their `inbound_only` comes from the
|
|
67
|
+
* price they paid.
|
|
68
|
+
*
|
|
69
|
+
* `body.billing_anchor_at` states the date the customer who pays for this
|
|
70
|
+
* line is billed on — every line that customer holds then moves together: one
|
|
71
|
+
* full month at each occurrence, with a credit at the first occurrence for
|
|
72
|
+
* the days the activation month had already paid for past it. Omit it and the
|
|
73
|
+
* line is billed on its activation instant.
|
|
63
74
|
*/
|
|
64
75
|
activate(id: string, body?: ActivateLineBody, opts?: RequestOptions): Promise<Line>;
|
|
65
76
|
/** `POST /v1/lines/{id}/release` — release an active or reserved line back to the pool. */
|
|
66
77
|
release(id: string, opts?: RequestOptions): Promise<Line>;
|
|
78
|
+
/**
|
|
79
|
+
* `POST /v1/lines/{id}/terminate` — permanently END a line you own. The
|
|
80
|
+
* self-serve counterpart to the admin terminate, and the verb to call when
|
|
81
|
+
* your own customer cancels: `release()` only returns a *reserved*
|
|
82
|
+
* marketplace line to the shelf, while this ends a live `rental` line or a
|
|
83
|
+
* virtual `shared` line for good.
|
|
84
|
+
*
|
|
85
|
+
* The line comes back at the terminal `cancelled` status, keeping its owner.
|
|
86
|
+
* Queued messages fail, shared-fleet bindings release, device sessions are
|
|
87
|
+
* revoked, and `line.disconnected` fires with `reason: "customer_initiated"`.
|
|
88
|
+
* Billing stops in both shapes — a per-line Stripe subscription is cancelled
|
|
89
|
+
* immediately, and a wholesale partner's end-of-month active-line count drops
|
|
90
|
+
* the line in the same breath.
|
|
91
|
+
*
|
|
92
|
+
* **Idempotent.** Terminating an already-terminated line resolves with the
|
|
93
|
+
* unchanged line (200), never a `ConflictError` — so a retry after a timeout
|
|
94
|
+
* is always safe and no `opts.idempotencyKey` is needed for it.
|
|
95
|
+
*
|
|
96
|
+
* Refusals: `BadRequestError` (400 `byod_not_customer_terminable`) — a BYOD
|
|
97
|
+
* line is your own hardware, billed per device slot by `/v1/byod/*`;
|
|
98
|
+
* `PermissionDeniedError` (403 `pool_line_not_terminable`) — an owned test
|
|
99
|
+
* line must go through `convertFromTest()` first; `NotFoundError` (404) — a
|
|
100
|
+
* line that does not exist, or one you do not own (the same code for both, so
|
|
101
|
+
* nothing leaks).
|
|
102
|
+
*
|
|
103
|
+
* `body` defaults to `{}` (not `undefined`) so the request always carries
|
|
104
|
+
* `Content-Type: application/json`; the route's body is optional and the
|
|
105
|
+
* handler treats a missing body as `{}`.
|
|
106
|
+
*/
|
|
107
|
+
terminate(id: string, body?: TerminateLineBody, opts?: RequestOptions): Promise<Line>;
|
|
108
|
+
/**
|
|
109
|
+
* `POST /v1/lines/{id}/cancel` — schedule the END of a line you own for its
|
|
110
|
+
* next billing anniversary, and keep using it until then.
|
|
111
|
+
*
|
|
112
|
+
* This is the verb for "my own customer cancelled". The month is already paid
|
|
113
|
+
* for and iSnap never prorates, so `terminate()` — which ends the line on the
|
|
114
|
+
* spot — throws away days you have bought. The line stays fully `active` and
|
|
115
|
+
* bills exactly as before; iSnap ends it itself when `cancel_at` arrives and
|
|
116
|
+
* fires `line.terminated` with `origin: "scheduled_cancellation"`.
|
|
117
|
+
*
|
|
118
|
+
* The resolved line carries `cancel_at`: the next occurrence of its
|
|
119
|
+
* `anniversary_at` strictly after now, clamped to the last day of a shorter
|
|
120
|
+
* month (a line taken on the 31st renews on the 28th in February and on the
|
|
121
|
+
* 31st again in March — the clamp never sticks).
|
|
122
|
+
*
|
|
123
|
+
* **Idempotent, and in the way that matters here.** Cancelling an
|
|
124
|
+
* already-cancelled line resolves with the SAME `cancel_at`, never a
|
|
125
|
+
* recomputed one — so a retry that happens to land after the stored date has
|
|
126
|
+
* passed cannot push your own cancellation a month into the future.
|
|
127
|
+
*
|
|
128
|
+
* Refusals: `ConflictError` (409 `line_has_no_anniversary`) — the line has no
|
|
129
|
+
* anniversary to cancel at; state it with `setAnniversary()`, or end the line
|
|
130
|
+
* now with `terminate()`. `ConflictError` (409
|
|
131
|
+
* `line_not_customer_cancellable`) — only an `active` or `suspended` line can
|
|
132
|
+
* be cancelled. `BadRequestError` (400 `byod_not_customer_cancellable`) and
|
|
133
|
+
* `PermissionDeniedError` (403 `pool_line_not_cancellable`) — those tiers have
|
|
134
|
+
* no per-line anniversary. `NotFoundError` (404) — a line that does not exist,
|
|
135
|
+
* or one you do not own (the same code for both, so nothing leaks).
|
|
136
|
+
*/
|
|
137
|
+
cancel(id: string, opts?: RequestOptions): Promise<Line>;
|
|
138
|
+
/**
|
|
139
|
+
* `POST /v1/lines/{id}/uncancel` — undo a scheduled cancellation. `cancel_at`
|
|
140
|
+
* goes back to `null` and the line resumes renewing at its anniversary.
|
|
141
|
+
*
|
|
142
|
+
* **A no-op on a line that is not cancelled**: resolves 200 with the line and
|
|
143
|
+
* `cancel_at: null`, never an error — so a reconciliation loop that asserts
|
|
144
|
+
* "this line must not be cancelled" can run unconditionally.
|
|
145
|
+
*
|
|
146
|
+
* Refusal: `ConflictError` (409 `line_already_terminated`) once the
|
|
147
|
+
* anniversary has passed and iSnap has ended the line. That cannot be undone.
|
|
148
|
+
*/
|
|
149
|
+
uncancel(id: string, opts?: RequestOptions): Promise<Line>;
|
|
150
|
+
/**
|
|
151
|
+
* `POST /v1/lines/{id}/anniversary` — state the instant you took this line,
|
|
152
|
+
* which becomes the day of the month it renews on and the date `cancel()`
|
|
153
|
+
* waits for.
|
|
154
|
+
*
|
|
155
|
+
* **For lines migrated from your own system**, whose real start date iSnap
|
|
156
|
+
* cannot know. A line taken through the iSnap API is stamped automatically at
|
|
157
|
+
* activation and needs no call.
|
|
158
|
+
*
|
|
159
|
+
* Refusal: `ConflictError` (409 `line_cancellation_pending`) while a
|
|
160
|
+
* cancellation is scheduled — that `cancel_at` was computed from the
|
|
161
|
+
* anniversary you are replacing, so uncancel, set the date, and cancel again.
|
|
162
|
+
*/
|
|
163
|
+
setAnniversary(id: string, body: SetLineAnniversaryBody, opts?: RequestOptions): Promise<Line>;
|
|
67
164
|
/**
|
|
68
165
|
* `POST /v1/lines/{id}/transfer-ownership` — reassign a line to a
|
|
69
166
|
* different end-user account without re-pairing the underlying device.
|
|
@@ -84,8 +181,111 @@ export declare class LinesResource extends BaseResource {
|
|
|
84
181
|
*/
|
|
85
182
|
convertFromTest(id: string, opts?: RequestOptions): Promise<Line>;
|
|
86
183
|
/**
|
|
87
|
-
* `
|
|
88
|
-
*
|
|
184
|
+
* `POST /v1/lines/{id}/variant` — move a rental line you own between the
|
|
185
|
+
* INBOUND product (`inbound_only: true`) and the TWO-WAY product, **keeping
|
|
186
|
+
* the same phone number**, the same hardware and the same device session.
|
|
187
|
+
*
|
|
188
|
+
* `inbound_only` is not "receive-only": the line converses normally, it
|
|
189
|
+
* simply cannot OPEN a conversation. It may message only a handle that has
|
|
190
|
+
* messaged it first, and once that handle has, the exchange is unrestricted
|
|
191
|
+
* in both directions for good. A send that breaks the rule is a
|
|
192
|
+
* `PermissionDeniedError` (403 `outbound_first_forbidden`).
|
|
193
|
+
*
|
|
194
|
+
* **Idempotent on the value.** Asking for the variant the line already has
|
|
195
|
+
* resolves with the line and writes nothing — no audit row, no
|
|
196
|
+
* `line.variant_changed` event — so a retry after a timeout is safe and is
|
|
197
|
+
* not a second change. It is not a toggle: state the value you want.
|
|
198
|
+
*
|
|
199
|
+
* `body.effective` says WHEN, and defaults to `'now'` — the only behaviour
|
|
200
|
+
* before the field existed, so an existing call is unchanged.
|
|
201
|
+
*
|
|
202
|
+
* - `'now'`: as above. Use it for an UPGRADE, which the customer has just
|
|
203
|
+
* paid for and which must apply to the very next send.
|
|
204
|
+
* - `'next_anchor'`: store the change against the line's next billing
|
|
205
|
+
* anchor. Nothing moves today — `inbound_only` keeps its current value and
|
|
206
|
+
* the line keeps serving the product it is being billed for — and the
|
|
207
|
+
* resolved line carries `pending_variant: { inbound_only, effective_at }`.
|
|
208
|
+
* Use it for a DOWNGRADE, so the customer keeps the two-way product
|
|
209
|
+
* through the month they have already bought. iSnap applies it at the
|
|
210
|
+
* anchor and fires `line.variant_changed` with `data.scheduled: true`;
|
|
211
|
+
* cancel it beforehand with {@link LinesResource.cancelVariantChange}.
|
|
212
|
+
*
|
|
213
|
+
* `body.not_before` (ISO instant, `'next_anchor'` only, defaults to now) is
|
|
214
|
+
* the earliest instant the change may take effect. iSnap resolves it to the
|
|
215
|
+
* FIRST anchor occurrence at or after it, applying the anchor's own
|
|
216
|
+
* day-of-month clamp — so state your customer's paid-period end and let
|
|
217
|
+
* iSnap pick the occurrence rather than computing one yourself. A monthly
|
|
218
|
+
* customer needs nothing here; a QUARTERLY or ANNUAL customer does, because
|
|
219
|
+
* without it the change would land on the next anchor and take back
|
|
220
|
+
* capability they have already paid for. The resolved instant comes back as
|
|
221
|
+
* `pending_variant.effective_at`. An instant in the past is a
|
|
222
|
+
* `BadRequestError` (400 `not_before_in_the_past`) — it is refused rather
|
|
223
|
+
* than clamped, because for a long-period customer the silent repair and the
|
|
224
|
+
* correct answer differ by months of the product they bought.
|
|
225
|
+
*
|
|
226
|
+
* Scheduling is idempotent on the PENDING value the same way an immediate
|
|
227
|
+
* change is on the live one: re-scheduling the change already pending
|
|
228
|
+
* resolves with the line and the date it was already given, and writes
|
|
229
|
+
* nothing. A DIFFERENT pending change is a `ConflictError` (409
|
|
230
|
+
* `variant_change_already_pending`) — cancel it first, because there is no
|
|
231
|
+
* honest way to merge two answers to "what is this line at the anchor".
|
|
232
|
+
*
|
|
233
|
+
* **A scheduled call can legitimately resolve with `pending_variant: null`,
|
|
234
|
+
* and that is not a failure.** Scheduling the variant the line ALREADY
|
|
235
|
+
* carries writes nothing, because nothing is pending — the line will still
|
|
236
|
+
* be on that variant at the anchor. Do not retry it. Tell it apart from a
|
|
237
|
+
* silently-dropped `effective` (see the deploy-order warning below) by
|
|
238
|
+
* reading the top-level `inbound_only`: equal to what you asked for means
|
|
239
|
+
* already-at-target; different means the field never reached the server and
|
|
240
|
+
* the change was applied immediately.
|
|
241
|
+
*
|
|
242
|
+
* ⚠️ **Adopt `effective` and `not_before` only against a deployment that has
|
|
243
|
+
* them.** iSnap STRIPS unknown request properties rather than rejecting
|
|
244
|
+
* them, so an early call gets no 400 — it gets the field dropped and an
|
|
245
|
+
* ordinary immediate flip, applying a downgrade on the spot. Check
|
|
246
|
+
* `client.version()` before sending either field.
|
|
247
|
+
*
|
|
248
|
+
* An immediate change does NOT cancel a scheduled one: they are separate
|
|
249
|
+
* acts, and a partner who needs an urgent upgrade must not have their
|
|
250
|
+
* standing downgrade withdrawn by it. Use `cancelVariantChange` for that.
|
|
251
|
+
*
|
|
252
|
+
* Refusals: `ConflictError` (409) — `not_a_rental_line` (byod / pool /
|
|
253
|
+
* shared have no variant), `line_not_active` (the line must be in service),
|
|
254
|
+
* `variant_bound_to_stripe_price` (the line carries an iSnap Stripe
|
|
255
|
+
* subscription, whose price IS its variant; change the subscription
|
|
256
|
+
* instead). A line the caller does not own is a masked `NotFoundError`
|
|
257
|
+
* (404), like every other per-line verb.
|
|
258
|
+
*/
|
|
259
|
+
setVariant(id: string, body: SetLineVariantBody, opts?: RequestOptions): Promise<Line>;
|
|
260
|
+
/**
|
|
261
|
+
* `DELETE /v1/lines/{id}/variant` — call off the variant change scheduled
|
|
262
|
+
* for this line's next billing anchor.
|
|
263
|
+
*
|
|
264
|
+
* The line's live `inbound_only` is never touched: the scheduling did not
|
|
265
|
+
* move it either, so the only effect is that `pending_variant` becomes
|
|
266
|
+
* `null` and nothing happens at the anchor.
|
|
267
|
+
*
|
|
268
|
+
* A line with no pending change is a `NotFoundError` (404
|
|
269
|
+
* `no_pending_variant_change`), which includes a change the anchor has
|
|
270
|
+
* already applied — there is nothing left to cancel, and the line's own
|
|
271
|
+
* `inbound_only` now carries the answer. A change applied while this request
|
|
272
|
+
* was in flight is a `ConflictError` (409 `variant_change_already_applied`),
|
|
273
|
+
* so the two outcomes are distinguishable from the code alone.
|
|
274
|
+
*
|
|
275
|
+
* Succeeds on a suspended or cancelled line: withdrawing an instruction must
|
|
276
|
+
* never be blocked by the state that made it moot.
|
|
277
|
+
*/
|
|
278
|
+
cancelVariantChange(id: string, opts?: RequestOptions): Promise<void>;
|
|
279
|
+
/**
|
|
280
|
+
* `PATCH /v1/lines/{id}` — update the line's free-form metadata object, its
|
|
281
|
+
* billing anchor, or both.
|
|
282
|
+
*
|
|
283
|
+
* `metadata` is a MERGE: null-valued keys delete those keys from the stored
|
|
284
|
+
* object. `billing_anchor_at` is the date the customer who pays for this line
|
|
285
|
+
* is billed on — a change takes effect at the NEXT occurrence and never
|
|
286
|
+
* rewrites a period already billed, and `null` clears it so the line falls
|
|
287
|
+
* back to its activation instant. Send at least one of the two; a body that
|
|
288
|
+
* states neither is refused with `no_fields_to_patch`.
|
|
89
289
|
*/
|
|
90
290
|
patch(id: string, body: PatchLineBody, opts?: RequestOptions): Promise<Line>;
|
|
91
291
|
/** `GET /v1/lines/{id}/quota` — the line's current 5-bucket quota snapshot. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lines.d.ts","sourceRoot":"","sources":["../../src/resources/lines.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAExC,MAAM,MAAM,IAAI,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAA;AAChD,MAAM,MAAM,QAAQ,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,UAAU,CAAC,CAAA;AACxD,MAAM,MAAM,OAAO,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,CAAA;AACtD,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,YAAY,CAAC,CAAA;AAChE,MAAM,MAAM,gBAAgB,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,cAAc,CAAC,CAAA;AACpE,MAAM,MAAM,qBAAqB,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,mBAAmB,CAAC,CAAA;AAC9E,MAAM,MAAM,aAAa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AI,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAS7E;;;;OAIG;IACH,YAAY,CACV,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,eAAe,EACrB,IAAI,CAAC,EAAE,cAAc,GACpB,OAAO,CAAC,sBAAsB,CAAC;CAQnC"}
|
package/dist/resources/lines.js
CHANGED
|
@@ -54,10 +54,18 @@ export class LinesResource extends BaseResource {
|
|
|
54
54
|
}
|
|
55
55
|
/**
|
|
56
56
|
* `POST /v1/lines/{id}/activate` — commit a reserved line to `active`.
|
|
57
|
-
* Wholesale partners
|
|
58
|
-
* Stripe checkout, EOM-metered)
|
|
59
|
-
* via `body.inbound_only`. Direct
|
|
60
|
-
*
|
|
57
|
+
* **Wholesale partners only**: the second phase of reserve→activate (no
|
|
58
|
+
* Stripe checkout, EOM-metered), which may pick the inbound-only rental
|
|
59
|
+
* variant via `body.inbound_only`. Direct customers get `402
|
|
60
|
+
* checkout_required` — their line activates when the Stripe Checkout session
|
|
61
|
+
* from `billing.checkout()` is paid, and their `inbound_only` comes from the
|
|
62
|
+
* price they paid.
|
|
63
|
+
*
|
|
64
|
+
* `body.billing_anchor_at` states the date the customer who pays for this
|
|
65
|
+
* line is billed on — every line that customer holds then moves together: one
|
|
66
|
+
* full month at each occurrence, with a credit at the first occurrence for
|
|
67
|
+
* the days the activation month had already paid for past it. Omit it and the
|
|
68
|
+
* line is billed on its activation instant.
|
|
61
69
|
*/
|
|
62
70
|
activate(id, body = {}, opts) {
|
|
63
71
|
return this.client.request('POST', `/v1/lines/${encodeURIComponent(id)}/activate`, body, opts);
|
|
@@ -66,6 +74,100 @@ export class LinesResource extends BaseResource {
|
|
|
66
74
|
release(id, opts) {
|
|
67
75
|
return this.client.request('POST', `/v1/lines/${encodeURIComponent(id)}/release`, undefined, opts);
|
|
68
76
|
}
|
|
77
|
+
/**
|
|
78
|
+
* `POST /v1/lines/{id}/terminate` — permanently END a line you own. The
|
|
79
|
+
* self-serve counterpart to the admin terminate, and the verb to call when
|
|
80
|
+
* your own customer cancels: `release()` only returns a *reserved*
|
|
81
|
+
* marketplace line to the shelf, while this ends a live `rental` line or a
|
|
82
|
+
* virtual `shared` line for good.
|
|
83
|
+
*
|
|
84
|
+
* The line comes back at the terminal `cancelled` status, keeping its owner.
|
|
85
|
+
* Queued messages fail, shared-fleet bindings release, device sessions are
|
|
86
|
+
* revoked, and `line.disconnected` fires with `reason: "customer_initiated"`.
|
|
87
|
+
* Billing stops in both shapes — a per-line Stripe subscription is cancelled
|
|
88
|
+
* immediately, and a wholesale partner's end-of-month active-line count drops
|
|
89
|
+
* the line in the same breath.
|
|
90
|
+
*
|
|
91
|
+
* **Idempotent.** Terminating an already-terminated line resolves with the
|
|
92
|
+
* unchanged line (200), never a `ConflictError` — so a retry after a timeout
|
|
93
|
+
* is always safe and no `opts.idempotencyKey` is needed for it.
|
|
94
|
+
*
|
|
95
|
+
* Refusals: `BadRequestError` (400 `byod_not_customer_terminable`) — a BYOD
|
|
96
|
+
* line is your own hardware, billed per device slot by `/v1/byod/*`;
|
|
97
|
+
* `PermissionDeniedError` (403 `pool_line_not_terminable`) — an owned test
|
|
98
|
+
* line must go through `convertFromTest()` first; `NotFoundError` (404) — a
|
|
99
|
+
* line that does not exist, or one you do not own (the same code for both, so
|
|
100
|
+
* nothing leaks).
|
|
101
|
+
*
|
|
102
|
+
* `body` defaults to `{}` (not `undefined`) so the request always carries
|
|
103
|
+
* `Content-Type: application/json`; the route's body is optional and the
|
|
104
|
+
* handler treats a missing body as `{}`.
|
|
105
|
+
*/
|
|
106
|
+
terminate(id, body = {}, opts) {
|
|
107
|
+
return this.client.request('POST', `/v1/lines/${encodeURIComponent(id)}/terminate`, body, opts);
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* `POST /v1/lines/{id}/cancel` — schedule the END of a line you own for its
|
|
111
|
+
* next billing anniversary, and keep using it until then.
|
|
112
|
+
*
|
|
113
|
+
* This is the verb for "my own customer cancelled". The month is already paid
|
|
114
|
+
* for and iSnap never prorates, so `terminate()` — which ends the line on the
|
|
115
|
+
* spot — throws away days you have bought. The line stays fully `active` and
|
|
116
|
+
* bills exactly as before; iSnap ends it itself when `cancel_at` arrives and
|
|
117
|
+
* fires `line.terminated` with `origin: "scheduled_cancellation"`.
|
|
118
|
+
*
|
|
119
|
+
* The resolved line carries `cancel_at`: the next occurrence of its
|
|
120
|
+
* `anniversary_at` strictly after now, clamped to the last day of a shorter
|
|
121
|
+
* month (a line taken on the 31st renews on the 28th in February and on the
|
|
122
|
+
* 31st again in March — the clamp never sticks).
|
|
123
|
+
*
|
|
124
|
+
* **Idempotent, and in the way that matters here.** Cancelling an
|
|
125
|
+
* already-cancelled line resolves with the SAME `cancel_at`, never a
|
|
126
|
+
* recomputed one — so a retry that happens to land after the stored date has
|
|
127
|
+
* passed cannot push your own cancellation a month into the future.
|
|
128
|
+
*
|
|
129
|
+
* Refusals: `ConflictError` (409 `line_has_no_anniversary`) — the line has no
|
|
130
|
+
* anniversary to cancel at; state it with `setAnniversary()`, or end the line
|
|
131
|
+
* now with `terminate()`. `ConflictError` (409
|
|
132
|
+
* `line_not_customer_cancellable`) — only an `active` or `suspended` line can
|
|
133
|
+
* be cancelled. `BadRequestError` (400 `byod_not_customer_cancellable`) and
|
|
134
|
+
* `PermissionDeniedError` (403 `pool_line_not_cancellable`) — those tiers have
|
|
135
|
+
* no per-line anniversary. `NotFoundError` (404) — a line that does not exist,
|
|
136
|
+
* or one you do not own (the same code for both, so nothing leaks).
|
|
137
|
+
*/
|
|
138
|
+
cancel(id, opts) {
|
|
139
|
+
return this.client.request('POST', `/v1/lines/${encodeURIComponent(id)}/cancel`, undefined, opts);
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* `POST /v1/lines/{id}/uncancel` — undo a scheduled cancellation. `cancel_at`
|
|
143
|
+
* goes back to `null` and the line resumes renewing at its anniversary.
|
|
144
|
+
*
|
|
145
|
+
* **A no-op on a line that is not cancelled**: resolves 200 with the line and
|
|
146
|
+
* `cancel_at: null`, never an error — so a reconciliation loop that asserts
|
|
147
|
+
* "this line must not be cancelled" can run unconditionally.
|
|
148
|
+
*
|
|
149
|
+
* Refusal: `ConflictError` (409 `line_already_terminated`) once the
|
|
150
|
+
* anniversary has passed and iSnap has ended the line. That cannot be undone.
|
|
151
|
+
*/
|
|
152
|
+
uncancel(id, opts) {
|
|
153
|
+
return this.client.request('POST', `/v1/lines/${encodeURIComponent(id)}/uncancel`, undefined, opts);
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* `POST /v1/lines/{id}/anniversary` — state the instant you took this line,
|
|
157
|
+
* which becomes the day of the month it renews on and the date `cancel()`
|
|
158
|
+
* waits for.
|
|
159
|
+
*
|
|
160
|
+
* **For lines migrated from your own system**, whose real start date iSnap
|
|
161
|
+
* cannot know. A line taken through the iSnap API is stamped automatically at
|
|
162
|
+
* activation and needs no call.
|
|
163
|
+
*
|
|
164
|
+
* Refusal: `ConflictError` (409 `line_cancellation_pending`) while a
|
|
165
|
+
* cancellation is scheduled — that `cancel_at` was computed from the
|
|
166
|
+
* anniversary you are replacing, so uncancel, set the date, and cancel again.
|
|
167
|
+
*/
|
|
168
|
+
setAnniversary(id, body, opts) {
|
|
169
|
+
return this.client.request('POST', `/v1/lines/${encodeURIComponent(id)}/anniversary`, body, opts);
|
|
170
|
+
}
|
|
69
171
|
/**
|
|
70
172
|
* `POST /v1/lines/{id}/transfer-ownership` — reassign a line to a
|
|
71
173
|
* different end-user account without re-pairing the underlying device.
|
|
@@ -92,8 +194,115 @@ export class LinesResource extends BaseResource {
|
|
|
92
194
|
return this.client.request('POST', `/v1/lines/${encodeURIComponent(id)}/convert-from-test`, undefined, opts);
|
|
93
195
|
}
|
|
94
196
|
/**
|
|
95
|
-
* `
|
|
96
|
-
*
|
|
197
|
+
* `POST /v1/lines/{id}/variant` — move a rental line you own between the
|
|
198
|
+
* INBOUND product (`inbound_only: true`) and the TWO-WAY product, **keeping
|
|
199
|
+
* the same phone number**, the same hardware and the same device session.
|
|
200
|
+
*
|
|
201
|
+
* `inbound_only` is not "receive-only": the line converses normally, it
|
|
202
|
+
* simply cannot OPEN a conversation. It may message only a handle that has
|
|
203
|
+
* messaged it first, and once that handle has, the exchange is unrestricted
|
|
204
|
+
* in both directions for good. A send that breaks the rule is a
|
|
205
|
+
* `PermissionDeniedError` (403 `outbound_first_forbidden`).
|
|
206
|
+
*
|
|
207
|
+
* **Idempotent on the value.** Asking for the variant the line already has
|
|
208
|
+
* resolves with the line and writes nothing — no audit row, no
|
|
209
|
+
* `line.variant_changed` event — so a retry after a timeout is safe and is
|
|
210
|
+
* not a second change. It is not a toggle: state the value you want.
|
|
211
|
+
*
|
|
212
|
+
* `body.effective` says WHEN, and defaults to `'now'` — the only behaviour
|
|
213
|
+
* before the field existed, so an existing call is unchanged.
|
|
214
|
+
*
|
|
215
|
+
* - `'now'`: as above. Use it for an UPGRADE, which the customer has just
|
|
216
|
+
* paid for and which must apply to the very next send.
|
|
217
|
+
* - `'next_anchor'`: store the change against the line's next billing
|
|
218
|
+
* anchor. Nothing moves today — `inbound_only` keeps its current value and
|
|
219
|
+
* the line keeps serving the product it is being billed for — and the
|
|
220
|
+
* resolved line carries `pending_variant: { inbound_only, effective_at }`.
|
|
221
|
+
* Use it for a DOWNGRADE, so the customer keeps the two-way product
|
|
222
|
+
* through the month they have already bought. iSnap applies it at the
|
|
223
|
+
* anchor and fires `line.variant_changed` with `data.scheduled: true`;
|
|
224
|
+
* cancel it beforehand with {@link LinesResource.cancelVariantChange}.
|
|
225
|
+
*
|
|
226
|
+
* `body.not_before` (ISO instant, `'next_anchor'` only, defaults to now) is
|
|
227
|
+
* the earliest instant the change may take effect. iSnap resolves it to the
|
|
228
|
+
* FIRST anchor occurrence at or after it, applying the anchor's own
|
|
229
|
+
* day-of-month clamp — so state your customer's paid-period end and let
|
|
230
|
+
* iSnap pick the occurrence rather than computing one yourself. A monthly
|
|
231
|
+
* customer needs nothing here; a QUARTERLY or ANNUAL customer does, because
|
|
232
|
+
* without it the change would land on the next anchor and take back
|
|
233
|
+
* capability they have already paid for. The resolved instant comes back as
|
|
234
|
+
* `pending_variant.effective_at`. An instant in the past is a
|
|
235
|
+
* `BadRequestError` (400 `not_before_in_the_past`) — it is refused rather
|
|
236
|
+
* than clamped, because for a long-period customer the silent repair and the
|
|
237
|
+
* correct answer differ by months of the product they bought.
|
|
238
|
+
*
|
|
239
|
+
* Scheduling is idempotent on the PENDING value the same way an immediate
|
|
240
|
+
* change is on the live one: re-scheduling the change already pending
|
|
241
|
+
* resolves with the line and the date it was already given, and writes
|
|
242
|
+
* nothing. A DIFFERENT pending change is a `ConflictError` (409
|
|
243
|
+
* `variant_change_already_pending`) — cancel it first, because there is no
|
|
244
|
+
* honest way to merge two answers to "what is this line at the anchor".
|
|
245
|
+
*
|
|
246
|
+
* **A scheduled call can legitimately resolve with `pending_variant: null`,
|
|
247
|
+
* and that is not a failure.** Scheduling the variant the line ALREADY
|
|
248
|
+
* carries writes nothing, because nothing is pending — the line will still
|
|
249
|
+
* be on that variant at the anchor. Do not retry it. Tell it apart from a
|
|
250
|
+
* silently-dropped `effective` (see the deploy-order warning below) by
|
|
251
|
+
* reading the top-level `inbound_only`: equal to what you asked for means
|
|
252
|
+
* already-at-target; different means the field never reached the server and
|
|
253
|
+
* the change was applied immediately.
|
|
254
|
+
*
|
|
255
|
+
* ⚠️ **Adopt `effective` and `not_before` only against a deployment that has
|
|
256
|
+
* them.** iSnap STRIPS unknown request properties rather than rejecting
|
|
257
|
+
* them, so an early call gets no 400 — it gets the field dropped and an
|
|
258
|
+
* ordinary immediate flip, applying a downgrade on the spot. Check
|
|
259
|
+
* `client.version()` before sending either field.
|
|
260
|
+
*
|
|
261
|
+
* An immediate change does NOT cancel a scheduled one: they are separate
|
|
262
|
+
* acts, and a partner who needs an urgent upgrade must not have their
|
|
263
|
+
* standing downgrade withdrawn by it. Use `cancelVariantChange` for that.
|
|
264
|
+
*
|
|
265
|
+
* Refusals: `ConflictError` (409) — `not_a_rental_line` (byod / pool /
|
|
266
|
+
* shared have no variant), `line_not_active` (the line must be in service),
|
|
267
|
+
* `variant_bound_to_stripe_price` (the line carries an iSnap Stripe
|
|
268
|
+
* subscription, whose price IS its variant; change the subscription
|
|
269
|
+
* instead). A line the caller does not own is a masked `NotFoundError`
|
|
270
|
+
* (404), like every other per-line verb.
|
|
271
|
+
*/
|
|
272
|
+
setVariant(id, body, opts) {
|
|
273
|
+
return this.client.request('POST', `/v1/lines/${encodeURIComponent(id)}/variant`, body, opts);
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* `DELETE /v1/lines/{id}/variant` — call off the variant change scheduled
|
|
277
|
+
* for this line's next billing anchor.
|
|
278
|
+
*
|
|
279
|
+
* The line's live `inbound_only` is never touched: the scheduling did not
|
|
280
|
+
* move it either, so the only effect is that `pending_variant` becomes
|
|
281
|
+
* `null` and nothing happens at the anchor.
|
|
282
|
+
*
|
|
283
|
+
* A line with no pending change is a `NotFoundError` (404
|
|
284
|
+
* `no_pending_variant_change`), which includes a change the anchor has
|
|
285
|
+
* already applied — there is nothing left to cancel, and the line's own
|
|
286
|
+
* `inbound_only` now carries the answer. A change applied while this request
|
|
287
|
+
* was in flight is a `ConflictError` (409 `variant_change_already_applied`),
|
|
288
|
+
* so the two outcomes are distinguishable from the code alone.
|
|
289
|
+
*
|
|
290
|
+
* Succeeds on a suspended or cancelled line: withdrawing an instruction must
|
|
291
|
+
* never be blocked by the state that made it moot.
|
|
292
|
+
*/
|
|
293
|
+
cancelVariantChange(id, opts) {
|
|
294
|
+
return this.client.request('DELETE', `/v1/lines/${encodeURIComponent(id)}/variant`, undefined, opts);
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* `PATCH /v1/lines/{id}` — update the line's free-form metadata object, its
|
|
298
|
+
* billing anchor, or both.
|
|
299
|
+
*
|
|
300
|
+
* `metadata` is a MERGE: null-valued keys delete those keys from the stored
|
|
301
|
+
* object. `billing_anchor_at` is the date the customer who pays for this line
|
|
302
|
+
* is billed on — a change takes effect at the NEXT occurrence and never
|
|
303
|
+
* rewrites a period already billed, and `null` clears it so the line falls
|
|
304
|
+
* back to its activation instant. Send at least one of the two; a body that
|
|
305
|
+
* states neither is refused with `no_fields_to_patch`.
|
|
97
306
|
*/
|
|
98
307
|
patch(id, body, opts) {
|
|
99
308
|
return this.client.request('PATCH', `/v1/lines/${encodeURIComponent(id)}`, body, opts);
|