UNPKG

@basetime/a2w-api-ts

Version:

Client library that communicates with the addtowallet API.

67 lines (66 loc) 2.15 kB
import { Requester } from '../http/Requester'; import { ApiKey } from '../types/ApiKey'; import { ScannerApp, ScannerAppInput } from '../types/ScannerApp'; import { ScannerDeviceInfo } from '../types/ScannerDeviceInfo'; import Endpoint from './Endpoint'; /** * Communicate with the scanners endpoints. */ export default class ScannersEndpoint extends Endpoint { /** * Constructor. * * @param req The object to use to make requests. */ constructor(req: Requester); /** * Returns the scanner app by registration code. * * @param registrationCode The registration code of the scanner app. * @returns The scanner app. */ getByRegistrationCode: (registrationCode: string) => Promise<ScannerApp | null>; /** * Registers a new scanner device. * * @param scannerApp The scanner app being registered. * @param pushToken The push token to send notifications to the device. * @param deviceInfo The device info. */ registerDevice: (scannerApp: ScannerApp, pushToken: string, deviceInfo: ScannerDeviceInfo) => Promise<ApiKey | null>; /** * Deregisters a scanner device. * * @param apiKey The API received when registering the device. */ deregisterDevice: (apiKey: ApiKey) => Promise<void>; /** * Returns all the scanner apps for the authenticated organization. */ getAll: () => Promise<ScannerApp[]>; /** * Returns the scanner app with the given ID. * * @param id The ID of the scanner app. */ getById: (id: string) => Promise<ScannerApp | null>; /** * Creates a new scanner app. * * @param app The scanner app to create. */ createApp: (app: ScannerAppInput) => Promise<ScannerApp | null>; /** * Updates a scanner app. * * @param id The ID of the scanner app. * @param app The scanner app to update. */ updateApp: (id: string, app: ScannerAppInput) => Promise<ScannerApp | null>; /** * Deletes a scanner app. * * @param id The ID of the scanner app. */ deleteApp: (id: string) => Promise<void>; }