@vertracloud/api-types 0.3.1 → 0.3.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 +1 -1
- package/payloads/v1/api-error.d.ts +4 -0
- package/payloads/v1/api-error.js +2 -0
- package/payloads/v1/api-error.js.map +1 -1
- package/payloads/v1/api-error.mjs +2 -0
- package/payloads/v1/api-key.js +8 -3
- package/payloads/v1/api-key.js.map +1 -1
- package/payloads/v1/api-key.mjs +8 -3
- package/payloads/v1/billing.d.ts +11 -3
- package/payloads/v1/billing.js.map +1 -1
- package/payloads/v1/index.js +10 -3
- package/payloads/v1/index.js.map +1 -1
- package/payloads/v1/index.mjs +10 -3
- package/payloads/v1/user.d.ts +2 -0
- package/payloads/v1/user.js.map +1 -1
- package/rest/v1/billing.d.ts +5 -4
- package/rest/v1/billing.js.map +1 -1
- package/rest/v1/user.d.ts +1 -0
- package/rest/v1/user.js.map +1 -1
- package/v1.js +10 -3
- package/v1.js.map +1 -1
- package/v1.mjs +10 -3
package/rest/v1/billing.d.ts
CHANGED
|
@@ -2,24 +2,25 @@ import { APIPayload } from '../../common/v1.js';
|
|
|
2
2
|
import { APIBillingCard, APIBillingDetails, APIBillingRenewal, APIBillingAddress, BillingTaxIdType } from '../../payloads/v1/billing.js';
|
|
3
3
|
import '../../payloads/v1/api-error.js';
|
|
4
4
|
|
|
5
|
-
/** `GET /v1/users/me/billing` —
|
|
5
|
+
/** `GET /v1/users/me/billing` — API key scope `billing:read`. `response` is `null` until details are saved. */
|
|
6
6
|
type RESTGetAPIBillingDetailsResponse = APIPayload<APIBillingDetails | null>;
|
|
7
7
|
/**
|
|
8
|
-
* `PUT /v1/users/me/billing` —
|
|
8
|
+
* `PUT /v1/users/me/billing` — API key scope `billing:write`. Replaces the billing details.
|
|
9
9
|
* Fails with 400 `BILLING_DETAILS_INVALID` (the field in `details.path`), 400 `TAX_ID_INVALID` and
|
|
10
10
|
* 400 `PAYMENT_METHOD_UNAVAILABLE` when online payments are not available.
|
|
11
11
|
*/
|
|
12
12
|
interface RESTPutAPIBillingDetailsBody {
|
|
13
13
|
name: string;
|
|
14
14
|
address: APIBillingAddress;
|
|
15
|
-
phone
|
|
15
|
+
/** Optional. E.164. `null` or omitted removes the saved phone. */
|
|
16
|
+
phone?: string | null;
|
|
16
17
|
/** Optional. `null` removes the saved document; omitting it keeps the saved one. */
|
|
17
18
|
tax_id?: {
|
|
18
19
|
type: BillingTaxIdType;
|
|
19
20
|
value: string;
|
|
20
21
|
} | null;
|
|
21
22
|
}
|
|
22
|
-
/** `PUT /v1/users/me/billing` —
|
|
23
|
+
/** `PUT /v1/users/me/billing` — API key scope `billing:write`. */
|
|
23
24
|
type RESTPutAPIBillingDetailsResponse = APIPayload<APIBillingDetails>;
|
|
24
25
|
/** `GET /v1/users/me/cards` — Dashboard session only. Default card first. */
|
|
25
26
|
type RESTGetAPIBillingCardsResponse = APIPayload<APIBillingCard[]>;
|
package/rest/v1/billing.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["billing.ts"],"sourcesContent":["import type { APIBillingAddress, APIBillingCard, APIBillingDetails, APIBillingRenewal, APIPayload, BillingTaxIdType } from \"../../v1\";\n\n/** `GET /v1/users/me/billing` —
|
|
1
|
+
{"version":3,"sources":["billing.ts"],"sourcesContent":["import type { APIBillingAddress, APIBillingCard, APIBillingDetails, APIBillingRenewal, APIPayload, BillingTaxIdType } from \"../../v1\";\n\n/** `GET /v1/users/me/billing` — API key scope `billing:read`. `response` is `null` until details are saved. */\nexport type RESTGetAPIBillingDetailsResponse = APIPayload<APIBillingDetails | null>;\n\n/**\n * `PUT /v1/users/me/billing` — API key scope `billing:write`. Replaces the billing details.\n * Fails with 400 `BILLING_DETAILS_INVALID` (the field in `details.path`), 400 `TAX_ID_INVALID` and\n * 400 `PAYMENT_METHOD_UNAVAILABLE` when online payments are not available.\n */\nexport interface RESTPutAPIBillingDetailsBody {\n\tname: string;\n\taddress: APIBillingAddress;\n\t/** Optional. E.164. `null` or omitted removes the saved phone. */\n\tphone?: string | null;\n\t/** Optional. `null` removes the saved document; omitting it keeps the saved one. */\n\ttax_id?: { type: BillingTaxIdType; value: string } | null;\n}\n\n/** `PUT /v1/users/me/billing` — API key scope `billing:write`. */\nexport type RESTPutAPIBillingDetailsResponse = APIPayload<APIBillingDetails>;\n\n/** `GET /v1/users/me/cards` — Dashboard session only. Default card first. */\nexport type RESTGetAPIBillingCardsResponse = APIPayload<APIBillingCard[]>;\n\n/**\n * `POST /v1/users/me/cards/setup` — Dashboard session only. Secret that saves a new card in the\n * browser. The card shows up in `GET /v1/users/me/cards` once confirmed; the first card becomes the default.\n * 400 `PAYMENT_METHOD_UNAVAILABLE` when online payments are not available.\n */\nexport type RESTPostAPIBillingCardSetupResponse = APIPayload<{ client_secret: string }>;\n\n/** `POST /v1/users/me/cards/:cardId/default` — Dashboard session only. 404 `CARD_NOT_FOUND`. */\nexport type RESTPostAPIBillingCardDefaultResponse = APIPayload<APIBillingCard[]>;\n\n/**\n * `DELETE /v1/users/me/cards/:cardId` — Dashboard session only. 404 `CARD_NOT_FOUND`.\n * Removing the default card makes the most recent remaining card the default; without cards,\n * the plan no longer renews automatically. 400 `PAYMENT_METHOD_UNAVAILABLE` when online payments are\n * not available.\n */\nexport type RESTDeleteAPIBillingCardResponse = APIPayload<null>;\n\n/** `GET /v1/users/me/billing/renewal` — Dashboard session only. */\nexport type RESTGetAPIBillingRenewalResponse = APIPayload<APIBillingRenewal>;\n\n/** `PATCH /v1/users/me/billing/renewal` — Dashboard session only. 400 `INVALID_PAYLOAD` for a malformed body. */\nexport interface RESTPatchAPIBillingRenewalBody {\n\t/** `false` cancels the automatic renewal (no charge is made later); `true` turns it back on. */\n\tauto_renew: boolean;\n}\n\n/** `PATCH /v1/users/me/billing/renewal` — Dashboard session only. */\nexport type RESTPatchAPIBillingRenewalResponse = APIPayload<APIBillingRenewal>;\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
package/rest/v1/user.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ interface RESTPatchAPIUserMeBody {
|
|
|
22
22
|
name?: string;
|
|
23
23
|
language?: UserLanguage;
|
|
24
24
|
workspace_invites_enabled?: boolean;
|
|
25
|
+
marketing_emails_enabled?: boolean;
|
|
25
26
|
}
|
|
26
27
|
type RESTPatchAPIUserMeResponse = APIPayload<APIUser>;
|
|
27
28
|
interface RESTPostAPIUserResourceFolderBody {
|
package/rest/v1/user.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["user.ts"],"sourcesContent":["import type { APIPaginatedPayload, APIPayload, APIUser, APIUserApiKey, APIUserApiKeyRequestEvent, APIUserInfoResponse, APIUserSession, ISODateString, UserLanguage } from \"../../v1\";\nimport type { APIWorkspaceResourceFolder, APIWorkspaceResourceOrganization, WorkspaceFolderColor } from \"../../v1\";\n\n/**\n * @see https://docs.vertracloud.app/api-reference/endpoint/users/me\n */\nexport type RESTGetAPIUserInfoResponse = APIPayload<APIUserInfoResponse>;\n\n/**\n * `POST /v1/users/me/downgrade` — dashboard session only.\n * @see https://docs.vertracloud.app/plan-downgrade\n */\nexport type RESTPostAPIUserDowngradeResponse = APIPayload<APIUser>;\n\n/**\n * `PATCH /v1/users/me`.\n * @see https://docs.vertracloud.app/api-reference/endpoint/users/update-me\n */\nexport interface RESTPatchAPIUserMeBody {\n\tname?: string;\n\tlanguage?: UserLanguage;\n\tworkspace_invites_enabled?: boolean;\n}\nexport type RESTPatchAPIUserMeResponse = APIPayload<APIUser>;\n\nexport interface RESTPostAPIUserResourceFolderBody {\n\tname: string;\n\tcolor?: WorkspaceFolderColor;\n\tposition?: number;\n}\nexport type RESTPostAPIUserResourceFolderResponse = APIPayload<APIWorkspaceResourceFolder>;\nexport interface RESTPatchAPIUserResourceFolderBody {\n\tname?: string;\n\tcolor?: WorkspaceFolderColor;\n\tposition?: number;\n}\nexport type RESTPatchAPIUserResourceFolderResponse = APIPayload<APIWorkspaceResourceFolder>;\nexport type RESTDeleteAPIUserResourceFolderResponse = APIPayload<null>;\nexport interface RESTPutAPIUserResourceFolderResourceBody {\n\tposition?: number;\n}\nexport type RESTPutAPIUserResourceFolderResourceResponse = APIPayload<APIWorkspaceResourceOrganization>;\nexport type RESTDeleteAPIUserResourceFolderResourceResponse = APIPayload<APIWorkspaceResourceOrganization>;\nexport interface RESTPutAPIUserFavoriteBody {\n\tposition?: number;\n}\nexport type RESTPutAPIUserFavoriteResponse = APIPayload<APIWorkspaceResourceOrganization>;\nexport type RESTDeleteAPIUserFavoriteResponse = APIPayload<APIWorkspaceResourceOrganization>;\n\n/**\n * Legacy CLI route; prefer the API key management under `/v1/users/me/api-keys`.\n * @see https://docs.vertracloud.app/api-reference/endpoint/users/api-keys/create\n */\nexport type RESTPostAPIUserGenerateApiKeyResponse = APIPayload<APIUserApiKey>;\n\n/**\n * @see https://docs.vertracloud.app/api-reference/endpoint/users/sessions\n */\nexport type RESTGetAPIUserSessionsResponse = APIPayload<APIUserSession[]>;\n\n/**\n * @see https://docs.vertracloud.app/api-reference/endpoint/users/api-key-requests\n */\nexport interface RESTGetAPIUserApiKeyRequestsQuery {\n\t/** Filters by key (`APIApiKey.id`). */\n\tapi_key_id?: string;\n\tfrom?: ISODateString;\n\tto?: ISODateString;\n\tpage?: number;\n\tper_page?: number;\n\terrors_only?: boolean;\n}\n\nexport type RESTGetAPIUserApiKeyRequestsResponse = APIPaginatedPayload<APIUserApiKeyRequestEvent>;\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
1
|
+
{"version":3,"sources":["user.ts"],"sourcesContent":["import type { APIPaginatedPayload, APIPayload, APIUser, APIUserApiKey, APIUserApiKeyRequestEvent, APIUserInfoResponse, APIUserSession, ISODateString, UserLanguage } from \"../../v1\";\nimport type { APIWorkspaceResourceFolder, APIWorkspaceResourceOrganization, WorkspaceFolderColor } from \"../../v1\";\n\n/**\n * @see https://docs.vertracloud.app/api-reference/endpoint/users/me\n */\nexport type RESTGetAPIUserInfoResponse = APIPayload<APIUserInfoResponse>;\n\n/**\n * `POST /v1/users/me/downgrade` — dashboard session only.\n * @see https://docs.vertracloud.app/plan-downgrade\n */\nexport type RESTPostAPIUserDowngradeResponse = APIPayload<APIUser>;\n\n/**\n * `PATCH /v1/users/me`.\n * @see https://docs.vertracloud.app/api-reference/endpoint/users/update-me\n */\nexport interface RESTPatchAPIUserMeBody {\n\tname?: string;\n\tlanguage?: UserLanguage;\n\tworkspace_invites_enabled?: boolean;\n\tmarketing_emails_enabled?: boolean;\n}\nexport type RESTPatchAPIUserMeResponse = APIPayload<APIUser>;\n\nexport interface RESTPostAPIUserResourceFolderBody {\n\tname: string;\n\tcolor?: WorkspaceFolderColor;\n\tposition?: number;\n}\nexport type RESTPostAPIUserResourceFolderResponse = APIPayload<APIWorkspaceResourceFolder>;\nexport interface RESTPatchAPIUserResourceFolderBody {\n\tname?: string;\n\tcolor?: WorkspaceFolderColor;\n\tposition?: number;\n}\nexport type RESTPatchAPIUserResourceFolderResponse = APIPayload<APIWorkspaceResourceFolder>;\nexport type RESTDeleteAPIUserResourceFolderResponse = APIPayload<null>;\nexport interface RESTPutAPIUserResourceFolderResourceBody {\n\tposition?: number;\n}\nexport type RESTPutAPIUserResourceFolderResourceResponse = APIPayload<APIWorkspaceResourceOrganization>;\nexport type RESTDeleteAPIUserResourceFolderResourceResponse = APIPayload<APIWorkspaceResourceOrganization>;\nexport interface RESTPutAPIUserFavoriteBody {\n\tposition?: number;\n}\nexport type RESTPutAPIUserFavoriteResponse = APIPayload<APIWorkspaceResourceOrganization>;\nexport type RESTDeleteAPIUserFavoriteResponse = APIPayload<APIWorkspaceResourceOrganization>;\n\n/**\n * Legacy CLI route; prefer the API key management under `/v1/users/me/api-keys`.\n * @see https://docs.vertracloud.app/api-reference/endpoint/users/api-keys/create\n */\nexport type RESTPostAPIUserGenerateApiKeyResponse = APIPayload<APIUserApiKey>;\n\n/**\n * @see https://docs.vertracloud.app/api-reference/endpoint/users/sessions\n */\nexport type RESTGetAPIUserSessionsResponse = APIPayload<APIUserSession[]>;\n\n/**\n * @see https://docs.vertracloud.app/api-reference/endpoint/users/api-key-requests\n */\nexport interface RESTGetAPIUserApiKeyRequestsQuery {\n\t/** Filters by key (`APIApiKey.id`). */\n\tapi_key_id?: string;\n\tfrom?: ISODateString;\n\tto?: ISODateString;\n\tpage?: number;\n\tper_page?: number;\n\terrors_only?: boolean;\n}\n\nexport type RESTGetAPIUserApiKeyRequestsResponse = APIPaginatedPayload<APIUserApiKeyRequestEvent>;\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
package/v1.js
CHANGED
|
@@ -329,15 +329,20 @@ var API_KEY_SCOPES = {
|
|
|
329
329
|
group: "billing",
|
|
330
330
|
routes: [
|
|
331
331
|
{ method: "GET", path: "/v1/orders" },
|
|
332
|
-
{ method: "GET", path: "/v1/orders/:orderId/status" }
|
|
332
|
+
{ method: "GET", path: "/v1/orders/:orderId/status" },
|
|
333
|
+
{ method: "GET", path: "/v1/users/me/billing" }
|
|
333
334
|
]
|
|
334
335
|
},
|
|
335
|
-
/**
|
|
336
|
+
/**
|
|
337
|
+
* Creates a plan order and generates the PIX charge; the payment itself is made by a person in their banking app.
|
|
338
|
+
* Also saves the billing details (name, address, CPF/CNPJ) an order needs.
|
|
339
|
+
*/
|
|
336
340
|
"billing:write": {
|
|
337
341
|
group: "billing",
|
|
338
342
|
routes: [
|
|
339
343
|
{ method: "POST", path: "/v1/orders" },
|
|
340
|
-
{ method: "POST", path: "/v1/orders/:orderId/initiate/pix" }
|
|
344
|
+
{ method: "POST", path: "/v1/orders/:orderId/initiate/pix" },
|
|
345
|
+
{ method: "PUT", path: "/v1/users/me/billing" }
|
|
341
346
|
]
|
|
342
347
|
},
|
|
343
348
|
"redeem:write": { group: "billing", routes: [{ method: "POST", path: "/v1/redeem/:code" }] }
|
|
@@ -489,6 +494,8 @@ var API_ERROR_CODES = {
|
|
|
489
494
|
APP_NOT_FOUND_IN_WORKSPACE: "APP_NOT_FOUND_IN_WORKSPACE",
|
|
490
495
|
BUILD_FAILED: "BUILD_FAILED",
|
|
491
496
|
BUILD_TIMEOUT: "BUILD_TIMEOUT",
|
|
497
|
+
/** 400 — the order needs complete billing details for the service invoice (name, address and, in Brazil, CPF/CNPJ). Fill them with `PUT /v1/users/me/billing`. */
|
|
498
|
+
BILLING_DETAILS_INCOMPLETE: "BILLING_DETAILS_INCOMPLETE",
|
|
492
499
|
/** 400 — billing details failed validation; the field is in `details.path`. */
|
|
493
500
|
BILLING_DETAILS_INVALID: "BILLING_DETAILS_INVALID",
|
|
494
501
|
/** 402 — the bank refused the card charge. */
|