1.0.0 • Published 6 months ago

@sentiment/api v1.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
6 months ago

@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",
  },
});