@aws-sdk/client-personalize
TypeScript icon, indicating that this package has built-in type declarations

3.796.0 • Public • Published

@aws-sdk/client-personalize

Description

AWS SDK for JavaScript Personalize Client for Node.js, Browser and React Native.

Amazon Personalize is a machine learning service that makes it easy to add individualized recommendations to customers.

Installing

To install this package, simply type add or install @aws-sdk/client-personalize using your favorite package manager:

  • npm install @aws-sdk/client-personalize
  • yarn add @aws-sdk/client-personalize
  • pnpm add @aws-sdk/client-personalize

Getting Started

Import

The AWS SDK is modulized by clients and commands. To send a request, you only need to import the PersonalizeClient and the commands you need, for example ListFiltersCommand:

// ES5 example
const { PersonalizeClient, ListFiltersCommand } = require("@aws-sdk/client-personalize");
// ES6+ example
import { PersonalizeClient, ListFiltersCommand } from "@aws-sdk/client-personalize";

Usage

To send a request, you:

  • Initiate client with configuration (e.g. credentials, region).
  • Initiate command with input parameters.
  • Call send operation on client with command object as input.
  • If you are using a custom http handler, you may call destroy() to close open connections.
// a client can be shared by different commands.
const client = new PersonalizeClient({ region: "REGION" });

const params = {
  /** input parameters */
};
const command = new ListFiltersCommand(params);

Async/await

We recommend using await operator to wait for the promise returned by send operation as follows:

// async/await.
try {
  const data = await client.send(command);
  // process data.
} catch (error) {
  // error handling.
} finally {
  // finally.
}

Async-await is clean, concise, intuitive, easy to debug and has better error handling as compared to using Promise chains or callbacks.

Promises

You can also use Promise chaining to execute send operation.

client.send(command).then(
  (data) => {
    // process data.
  },
  (error) => {
    // error handling.
  }
);

Promises can also be called using .catch() and .finally() as follows:

client
  .send(command)
  .then((data) => {
    // process data.
  })
  .catch((error) => {
    // error handling.
  })
  .finally(() => {
    // finally.
  });

Callbacks

We do not recommend using callbacks because of callback hell, but they are supported by the send operation.

// callbacks.
client.send(command, (err, data) => {
  // process err and data.
});

v2 compatible style

The client can also send requests using v2 compatible style. However, it results in a bigger bundle size and may be dropped in next major version. More details in the blog post on modular packages in AWS SDK for JavaScript

import * as AWS from "@aws-sdk/client-personalize";
const client = new AWS.Personalize({ region: "REGION" });

// async/await.
try {
  const data = await client.listFilters(params);
  // process data.
} catch (error) {
  // error handling.
}

// Promises.
client
  .listFilters(params)
  .then((data) => {
    // process data.
  })
  .catch((error) => {
    // error handling.
  });

// callbacks.
client.listFilters(params, (err, data) => {
  // process err and data.
});

Troubleshooting

When the service returns an exception, the error will include the exception information, as well as response metadata (e.g. request id).

try {
  const data = await client.send(command);
  // process data.
} catch (error) {
  const { requestId, cfId, extendedRequestId } = error.$metadata;
  console.log({ requestId, cfId, extendedRequestId });
  /**
   * The keys within exceptions are also parsed.
   * You can access them by specifying exception names:
   * if (error.name === 'SomeServiceException') {
   *     const value = error.specialKeyInException;
   * }
   */
}

Getting Help

Please use these community resources for getting help. We use the GitHub issues for tracking bugs and feature requests, but have limited bandwidth to address them.

To test your universal JavaScript code in Node.js, browser and react-native environments, visit our code samples repo.

Contributing

This client code is generated automatically. Any modifications will be overwritten the next time the @aws-sdk/client-personalize package is updated. To contribute to client you can check our generate clients scripts.

License

This SDK is distributed under the Apache License, Version 2.0, see LICENSE for more information.

Client Commands (Operations List)

CreateBatchInferenceJob

Command API Reference / Input / Output

CreateBatchSegmentJob

Command API Reference / Input / Output

CreateCampaign

Command API Reference / Input / Output

CreateDataDeletionJob

Command API Reference / Input / Output

CreateDataset

Command API Reference / Input / Output

CreateDatasetExportJob

Command API Reference / Input / Output

CreateDatasetGroup

Command API Reference / Input / Output

CreateDatasetImportJob

Command API Reference / Input / Output

CreateEventTracker

Command API Reference / Input / Output

CreateFilter

Command API Reference / Input / Output

CreateMetricAttribution

Command API Reference / Input / Output

CreateRecommender

Command API Reference / Input / Output

CreateSchema

Command API Reference / Input / Output

CreateSolution

Command API Reference / Input / Output

CreateSolutionVersion

Command API Reference / Input / Output

DeleteCampaign

Command API Reference / Input / Output

DeleteDataset

Command API Reference / Input / Output

DeleteDatasetGroup

Command API Reference / Input / Output

DeleteEventTracker

Command API Reference / Input / Output

DeleteFilter

Command API Reference / Input / Output

DeleteMetricAttribution

Command API Reference / Input / Output

DeleteRecommender

Command API Reference / Input / Output

DeleteSchema

Command API Reference / Input / Output

DeleteSolution

Command API Reference / Input / Output

DescribeAlgorithm

Command API Reference / Input / Output

DescribeBatchInferenceJob

Command API Reference / Input / Output

DescribeBatchSegmentJob

Command API Reference / Input / Output

DescribeCampaign

Command API Reference / Input / Output

DescribeDataDeletionJob

Command API Reference / Input / Output

DescribeDataset

Command API Reference / Input / Output

DescribeDatasetExportJob

Command API Reference / Input / Output

DescribeDatasetGroup

Command API Reference / Input / Output

DescribeDatasetImportJob

Command API Reference / Input / Output

DescribeEventTracker

Command API Reference / Input / Output

DescribeFeatureTransformation

Command API Reference / Input / Output

DescribeFilter

Command API Reference / Input / Output

DescribeMetricAttribution

Command API Reference / Input / Output

DescribeRecipe

Command API Reference / Input / Output

DescribeRecommender

Command API Reference / Input / Output

DescribeSchema

Command API Reference / Input / Output

DescribeSolution

Command API Reference / Input / Output

DescribeSolutionVersion

Command API Reference / Input / Output

GetSolutionMetrics

Command API Reference / Input / Output

ListBatchInferenceJobs

Command API Reference / Input / Output

ListBatchSegmentJobs

Command API Reference / Input / Output

ListCampaigns

Command API Reference / Input / Output

ListDataDeletionJobs

Command API Reference / Input / Output

ListDatasetExportJobs

Command API Reference / Input / Output

ListDatasetGroups

Command API Reference / Input / Output

ListDatasetImportJobs

Command API Reference / Input / Output

ListDatasets

Command API Reference / Input / Output

ListEventTrackers

Command API Reference / Input / Output

ListFilters

Command API Reference / Input / Output

ListMetricAttributionMetrics

Command API Reference / Input / Output

ListMetricAttributions

Command API Reference / Input / Output

ListRecipes

Command API Reference / Input / Output

ListRecommenders

Command API Reference / Input / Output

ListSchemas

Command API Reference / Input / Output

ListSolutions

Command API Reference / Input / Output

ListSolutionVersions

Command API Reference / Input / Output

ListTagsForResource

Command API Reference / Input / Output

StartRecommender

Command API Reference / Input / Output

StopRecommender

Command API Reference / Input / Output

StopSolutionVersionCreation

Command API Reference / Input / Output

TagResource

Command API Reference / Input / Output

UntagResource

Command API Reference / Input / Output

UpdateCampaign

Command API Reference / Input / Output

UpdateDataset

Command API Reference / Input / Output

UpdateMetricAttribution

Command API Reference / Input / Output

UpdateRecommender

Command API Reference / Input / Output

UpdateSolution

Command API Reference / Input / Output

Readme

Keywords

none

Package Sidebar

Install

npm i @aws-sdk/client-personalize

Weekly Downloads

60,635

Version

3.796.0

License

Apache-2.0

Unpacked Size

1.39 MB

Total Files

335

Last publish

Collaborators

  • amzn-oss
  • aws-sdk-bot