@delopay/sdk 0.184.0 → 0.185.0

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/dist/index.cjs CHANGED
@@ -5200,6 +5200,19 @@ var Products = class {
5200
5200
  ...this.scoped(profileId, options)
5201
5201
  });
5202
5202
  }
5203
+ /**
5204
+ * Find the product a name or a connector's id belongs to. Pass exactly one
5205
+ * of `alias`, `connector_product_id` and `connector_price_id`; the connector
5206
+ * ids need `connector` as well. Archived products resolve too, so a payment
5207
+ * that references one is still attributed. No match answers 404.
5208
+ * `GET /products/resolve`
5209
+ */
5210
+ async resolve(query, profileId, options) {
5211
+ return this.request("GET", "/products/resolve", {
5212
+ query: { ...query },
5213
+ ...this.scoped(profileId, options)
5214
+ });
5215
+ }
5203
5216
  /**
5204
5217
  * Retrieve one product with its prices.
5205
5218
  * `GET /products/{product_id}`
@@ -5210,7 +5223,8 @@ var Products = class {
5210
5223
  });
5211
5224
  }
5212
5225
  /**
5213
- * Change a product's name, description or metadata.
5226
+ * Change a product's name, description, image, metadata or category
5227
+ * (`category_id: null` makes it uncategorized).
5214
5228
  * `POST /products/{product_id}`
5215
5229
  *
5216
5230
  * Its kind and its prices are not editable here — see the class note.
@@ -5334,6 +5348,148 @@ var Products = class {
5334
5348
  ...this.scoped(profileId, options)
5335
5349
  });
5336
5350
  }
5351
+ // --- identity: names and connector references ---------------------
5352
+ /**
5353
+ * Add a name the product goes by. A name it already goes by is returned
5354
+ * as it is; one another product of the shop goes by is refused.
5355
+ * `POST /products/{product_id}/aliases`
5356
+ */
5357
+ async addAlias(productId, body, profileId, options) {
5358
+ return this.request("POST", `/products/${encodeURIComponent(productId)}/aliases`, {
5359
+ body,
5360
+ ...this.scoped(profileId, options)
5361
+ });
5362
+ }
5363
+ /**
5364
+ * Remove a name the product goes by. Its current name stays.
5365
+ * `POST /products/{product_id}/aliases/{alias_id}/remove`
5366
+ */
5367
+ async removeAlias(productId, aliasId, profileId, options) {
5368
+ return this.request(
5369
+ "POST",
5370
+ `/products/${encodeURIComponent(productId)}/aliases/${encodeURIComponent(aliasId)}/remove`,
5371
+ { ...this.scoped(profileId, options) }
5372
+ );
5373
+ }
5374
+ /**
5375
+ * Tie a connected account's product, or one of its prices, to the product.
5376
+ * Recorded as `manual_id`: the ids are not checked against the account.
5377
+ * `POST /products/{product_id}/connector-references`
5378
+ */
5379
+ async addConnectorReference(productId, body, profileId, options) {
5380
+ return this.request("POST", `/products/${encodeURIComponent(productId)}/connector-references`, {
5381
+ body,
5382
+ ...this.scoped(profileId, options)
5383
+ });
5384
+ }
5385
+ /**
5386
+ * Remove a connected account's product or price from the product.
5387
+ * `POST /products/{product_id}/connector-references/{reference_id}/remove`
5388
+ */
5389
+ async removeConnectorReference(productId, referenceId, profileId, options) {
5390
+ return this.request(
5391
+ "POST",
5392
+ `/products/${encodeURIComponent(productId)}/connector-references/${encodeURIComponent(referenceId)}/remove`,
5393
+ { ...this.scoped(profileId, options) }
5394
+ );
5395
+ }
5396
+ /**
5397
+ * One bounded page of a connected billing account's products, to pick an
5398
+ * existing one to tie to a product. Reads only.
5399
+ * `GET /products/import-suggestions`
5400
+ */
5401
+ async importSuggestions(query, profileId, options) {
5402
+ return this.request("GET", "/products/import-suggestions", {
5403
+ query: { ...query },
5404
+ ...this.scoped(profileId, options)
5405
+ });
5406
+ }
5407
+ /**
5408
+ * Tie one of a connected account's existing products (or a price of it) to
5409
+ * the product, verified against a fresh read of the page it was suggested
5410
+ * on — pass the same `limit` and `offset`. Recorded as `map_existing`.
5411
+ * `POST /products/{product_id}/connector-references/import`
5412
+ */
5413
+ async acceptImport(productId, body, profileId, options) {
5414
+ return this.request(
5415
+ "POST",
5416
+ `/products/${encodeURIComponent(productId)}/connector-references/import`,
5417
+ { body, ...this.scoped(profileId, options) }
5418
+ );
5419
+ }
5420
+ // --- categories ------------------------------------------------------
5421
+ /**
5422
+ * Add a category to the shop, at the end of its order. File products under
5423
+ * it with `category_id` on `create` or `update`.
5424
+ * `POST /products/categories`
5425
+ */
5426
+ async createCategory(body, profileId, options) {
5427
+ return this.request("POST", "/products/categories", {
5428
+ body,
5429
+ ...this.scoped(profileId, options)
5430
+ });
5431
+ }
5432
+ /**
5433
+ * The shop's categories in order. Archived ones only with
5434
+ * `include_archived`; deleted ones never.
5435
+ * `GET /products/categories/list`
5436
+ */
5437
+ async listCategories(query, profileId, options) {
5438
+ return this.request("GET", "/products/categories/list", {
5439
+ query: query === void 0 ? void 0 : { ...query },
5440
+ ...this.scoped(profileId, options)
5441
+ });
5442
+ }
5443
+ /**
5444
+ * Put the shop's categories in a new order. Name every live category,
5445
+ * archived ones included, exactly once. Returns the categories in their new
5446
+ * order.
5447
+ * `POST /products/categories/reorder`
5448
+ */
5449
+ async reorderCategories(body, profileId, options) {
5450
+ return this.request("POST", "/products/categories/reorder", {
5451
+ body,
5452
+ ...this.scoped(profileId, options)
5453
+ });
5454
+ }
5455
+ /**
5456
+ * Rename a category.
5457
+ * `POST /products/categories/{category_id}`
5458
+ */
5459
+ async updateCategory(categoryId, changes, profileId, options) {
5460
+ return this.request("POST", `/products/categories/${encodeURIComponent(categoryId)}`, {
5461
+ body: changes,
5462
+ ...this.scoped(profileId, options)
5463
+ });
5464
+ }
5465
+ /**
5466
+ * Mark a category deleted. Its products become uncategorized and no payment
5467
+ * changes. Returns the deleted category.
5468
+ * `DELETE /products/categories/{category_id}`
5469
+ */
5470
+ async deleteCategory(categoryId, profileId, options) {
5471
+ return this.request("DELETE", `/products/categories/${encodeURIComponent(categoryId)}`, {
5472
+ ...this.scoped(profileId, options)
5473
+ });
5474
+ }
5475
+ /**
5476
+ * Keep a category with its products, but file no new product under it.
5477
+ * `POST /products/categories/{category_id}/archive`
5478
+ */
5479
+ async archiveCategory(categoryId, profileId, options) {
5480
+ return this.request("POST", `/products/categories/${encodeURIComponent(categoryId)}/archive`, {
5481
+ ...this.scoped(profileId, options)
5482
+ });
5483
+ }
5484
+ /**
5485
+ * Let an archived category take products again.
5486
+ * `POST /products/categories/{category_id}/restore`
5487
+ */
5488
+ async restoreCategory(categoryId, profileId, options) {
5489
+ return this.request("POST", `/products/categories/${encodeURIComponent(categoryId)}/restore`, {
5490
+ ...this.scoped(profileId, options)
5491
+ });
5492
+ }
5337
5493
  // --- provider import ---------------------------------------------
5338
5494
  /**
5339
5495
  * Read a connected billing account's products and say how each relates to