Update Product

payments/update-product@1.0.0
Supported by 2 providers
P
S

Update Product

Updates information about an existing product. Heads up! Not all providers may support updating all fields. Please be mindful of the `result`.

Input
ID
New name
Description
Result
Name
Description

1.Choose a provider

2.Use UpdateProduct with mock in your code

npm i @superfaceai/one-sdk
const { SuperfaceClient } = require('@superfaceai/one-sdk');

const sdk = new SuperfaceClient();

async function run() {
  // Load the profile
  const profile = await sdk.getProfile('payments/update-product@1.0.0');

  // Use the profile
  const result = await profile
    .getUseCase('UpdateProduct')
    .perform({
      productId: '',
      name: '',
      description: ''
    }, {
      provider: 'mock'
    });

  // Handle the result
  try {
    const data = result.unwrap();
    console.log(data);
  } catch (error) {
    console.error(error);
  }
}

run();

Structure details

Input (object)

productId
Identifier of the product for updating.
name
New name to be set on the product.
description
New description to be set on the product.

Example

{
  "productId": "",
  "name": "",
  "description": ""
}

Result (object)

name
Name of the product after update (may or may not have changed).
description
Description of the product after update (may or may not have changed).

Example

{
  "name": "",
  "description": ""
}

Implementation details

Provider
mock
Use case
UpdateProduct
Author
@superface
Source
Verified