UNPKG

@point-api/js-sdk

Version:

Javascript SDK for Point API

27 lines (26 loc) 1.01 kB
import { PointApi } from "../main"; import { Snippet } from "./autocompleteSession"; /** Result of a GET request to api */ export interface GetResponse { snippets: Snippet[]; } /** Result containing just a status field */ interface StatusResponse { status: string; } /** Class to keep track of api credentials and make requests to the custom suggestions api */ export default class SnippetApiModule { private readonly api; private readonly url; constructor(api: PointApi); /** Get custom suggestions and hotkeys */ get(): Promise<GetResponse>; /** Delete a custom suggestion or hotkey */ delete(snippetId: string): Promise<StatusResponse>; edit(snippetId: string, newContent: string, newName: string, labels: string[]): Promise<StatusResponse>; /** Add a custom suggestion or hotkey */ add(content: string, name: string, labels: string[]): Promise<StatusResponse>; /** Make authenticated request to custom suggestions api */ private authFetch; } export {};