Superface

Update Product

payments/update-product@1.0.0
2 providers

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

Below instructions are for our Node.js SDK. Use OneService for other languages.
npm i @superfaceai/one-sdk
const { SuperfaceClient } = require('@superfaceai/one-sdk');

// You can manage tokens here: https://superface.ai/insights
const sdk = new SuperfaceClient({ sdkAuthToken: '<< Login to get your token >>' });

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