@vertracloud/api-types 0.3.0 → 0.3.2

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.
@@ -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` — Dashboard session only. `response` is `null` until details are saved. */
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` — Dashboard session only. Replaces the billing details.
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: string;
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` — Dashboard session only. */
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[]>;
@@ -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` — Dashboard session only. `response` is `null` until details are saved. */\nexport type RESTGetAPIBillingDetailsResponse = APIPayload<APIBillingDetails | null>;\n\n/**\n * `PUT /v1/users/me/billing` — Dashboard session only. 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\tphone: string;\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` — Dashboard session only. */\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":[]}
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/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
- /** Creates a plan order and generates the PIX charge; the payment itself is made by a person in their banking app. */
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. */
@@ -594,6 +601,8 @@ var API_ERROR_CODES = {
594
601
  ORDER_RECEIPT_UNAVAILABLE: "ORDER_RECEIPT_UNAVAILABLE",
595
602
  OWNER_APP_WITHOUT_LIMITS: "OWNER_APP_WITHOUT_LIMITS",
596
603
  PAYLOAD_TOO_LARGE: "PAYLOAD_TOO_LARGE",
604
+ /** 409 — a folder in the path is an existing file (writing `app/x.js` when `app` is a file). */
605
+ PATH_IS_FILE: "PATH_IS_FILE",
597
606
  PENDING_ORDER_LIMIT_REACHED: "PENDING_ORDER_LIMIT_REACHED",
598
607
  PAYMENT_METHOD_UNAVAILABLE: "PAYMENT_METHOD_UNAVAILABLE",
599
608
  PLAN_DOES_NOT_SUPPORT_CUSTOM_DOMAIN: "PLAN_DOES_NOT_SUPPORT_CUSTOM_DOMAIN",