@synerise/faststore-api
v0.0.3
Published
<h1 align="center"> Synerise Faststore API </h1>
Readme
Installation
From the command line in your project directory, run yarn add @synerise/faststore-api.
yarn add @synerise/faststore-apiUsage
Import resolvers
// src/graphql/thirdParty/resolvers/index.ts
import { Resolvers as SyneriseResolvers } from "@synerise/faststore-api";
const resolvers = {
...SyneriseResolvers,
};
export default resolvers;After adding the resolvers, ensure you copy the files from the typeDefs folder to your project's
src/graphql/thirdParty/typeDefs folder. This step is required to integrate the schema definitions properly.
This approach allows you to directly integrate pre-defined resolvers into your application, making it easier to set up and use the provided functionalities.
Required Environment Variables
You can use the provided resolvers by either adding the following environment variables to your vtex.env file:
SYNERISE_API_URL=https://api.synerise.com
SYNERISE_API_TRACKER=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
SYNERISE_SEARCH_INDEX=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxor by specifying indexId, apiHost, and trackerKey directly in your GraphQL queries:
query SyneriseSearchQuery(
$apiHost: String,
$trackerKey: String,
$indexId: String,
$query: String!
) {
syneriseAISearch(indexId: $indexId, apiHost: $apiHost, trackerKey: $trackerKey) {
search(
query: $query,
) {
...
}
}
}These variables are necessary for proper configuration and communication with the Synerise API.
Import Individual Client
Alternatively, you can import and configure a specific client for more granular control:
import { SyneriseSearchClient } from '@synerise/faststore-api';
const searchClient = new SyneriseSearchClient({
host: "https://api.synerise.com",
trackerKey: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
indexId: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
});
// Use the search client as neededThis method is suitable when you need to work with a specific service or API client, allowing you to customize the configuration and use only the functionalities you need.
