@sentiment/api
v1.0.0
Published
Sentiment-api is an api wrapper for the Sentiment client API
Downloads
33
Maintainers
Readme
@sentiment/api - API Wrapper for Sentiment
Installation
npm install @sentiment/api
Usage
import { SentimentAPI, EnvironmentId } from "@sentiment/api";
const api = new SentimentAPI({
apiHost: "http://localhost:3000",
environmentId: "clgwh8maj0005n2f66pwzev3r" as EnvironmentId,
});
Note All of the following methods return a
Result
from the@sentiment/errors
package.
const response = await api.createResponse({
surveyId: "......" as SurveyId,
personId: "......" as PersonId,
data: {
questionId: "response",
},
});
const response = await api.updateResponse({
responseId: "......" as ResponseId, // If you pass response.value.id from createResponse, you dont need 'as ResponseId'
data: {
questionId: "response",
},
});