@basetime/a2w-api-ts
Version:
Client library that communicates with the addtowallet API.
52 lines (51 loc) • 1.55 kB
TypeScript
import { ApiKey } from '../types/ApiKey';
import { Organization } from '../types/Organization';
import { ScannerInvite } from '../types/ScannerInvite';
import Endpoint from './Endpoint';
/**
* Communicate with the organizations endpoints.
*/
export default class OrganizationsEndpoint extends Endpoint {
/**
* Returns the authenticated organization.
*
* @returns The organization.
*/
getMine: () => Promise<Organization>;
/**
* Returns a scanner invite by code.
*
* @param code The invite code.
*/
getScannerInvite: (code: string) => Promise<ScannerInvite | null>;
/**
* Begins the scanner exchange.
*
* @param code The invite code.
*/
startScannerExchange: (code: string) => Promise<ScannerInvite | null>;
/**
* Accepts an scanner app invite code and returns api keys.
*
* @param code The invite code.
* @param pushToken The push token.
* @param scannerDeviceInfo The scanner device info.
*/
finishScannerExchange: (code: string, pushToken: string, scannerDeviceInfo: any) => Promise<ApiKey>;
/**
* Returns the API keys for the authenticated organization.
*/
getApiKeys: () => Promise<ApiKey[]>;
/**
* Returns an API key by ID.
*
* @param id The ID of the API key.
*/
getApiKey: (id: string, scanner?: any) => Promise<ApiKey | null>;
/**
* Deletes an API key.
*
* @param id The ID of the API key.
*/
deleteApiKey: (id: string) => Promise<void>;
}