@allthings/sdk
Version:
Allthings Node/Javascript SDK
188 lines (187 loc) • 9.47 kB
TypeScript
import { ITokenStore, TokenRequester } from '../oauth/types';
import { MethodHttpDelete } from './delete';
import { MethodHttpGet } from './get';
import { MethodAgentCreate, MethodAgentCreatePermissions } from './methods/agent';
import { MethodAppCreate, MethodAppGetById } from './methods/app';
import { MethodBookingGetById, MethodBookingUpdateById } from './methods/booking';
import { MethodBucketAddFile, MethodBucketCreate, MethodBucketGet, MethodBucketRemoveFile, MethodBucketRemoveFilesInPath } from './methods/bucket';
import { MethodConversationCreateMessage, MethodConversationGetById } from './methods/conversation';
import { MethodFileCreate, MethodFileDelete } from './methods/file';
import { MethodGetGroups, MethodGroupCreate, MethodGroupGetById, MethodGroupUpdateById } from './methods/group';
import { MethodLookupIds } from './methods/idLookup';
import { MethodNotificationsGetByUser, MethodNotificationsUpdateReadByUser, MethodNotificationUpdateRead } from './methods/notification';
import { MethodNotificationSettingsResetByUser, MethodNotificationSettingsUpdateByUser } from './methods/notificationSettings';
import { MethodGetProperties, MethodPropertyCreate, MethodPropertyGetById, MethodPropertyUpdateById } from './methods/property';
import { MethodRegistrationCodeCreate, MethodRegistrationCodeDelete, MethodRegistrationCodeGetById, MethodRegistrationCodeUpdateById } from './methods/registrationCode';
import { MethodServiceProviderCreate, MethodServiceProviderGetById, MethodServiceProviderUpdateById } from './methods/serviceProvider';
import { MethodTicketCreateOnServiceProvider, MethodTicketCreateOnUser, MethodTicketGetById } from './methods/ticket';
import { MethodGetUnits, MethodUnitCreate, MethodUnitGetById, MethodUnitUpdateById } from './methods/unit';
import { MethodGetCurrentUser, MethodGetUsers, MethodUserChangePassword, MethodUserCheckInToUtilisationPeriod, MethodUserCreate, MethodUserCreatePermission, MethodUserCreatePermissionBatch, MethodUserDeletePermission, MethodUserGetByEmail, MethodUserGetById, MethodUserGetPermissions, MethodUserGetUtilisationPeriods, MethodUserUpdateById } from './methods/user';
import { MethodUserRelationCreate, MethodUserRelationDelete, MethodUserRelationsGetByUser } from './methods/userRelation';
import { MethodUtilisationPeriodAddRegistrationCode, MethodUtilisationPeriodCheckInUser, MethodUtilisationPeriodCheckOutUser, MethodUtilisationPeriodCreate, MethodUtilisationPeriodDelete, MethodUtilisationPeriodGetById, MethodUtilisationPeriodUpdateById } from './methods/utilisationPeriod';
import { MethodHttpPatch } from './patch';
import { MethodHttpPost } from './post';
import { MethodHttpPut } from './put';
export declare enum EnumResource {
group = "group",
property = "property",
serviceProvider = "propertyManager",
registrationCode = "registrationCode",
unit = "unit",
user = "user",
utilisationPeriod = "utilisationPeriod"
}
export declare enum EnumCountryCode {
CH = "CH",
DE = "DE",
FR = "FR",
IT = "IT",
NL = "NL",
PT = "PT",
US = "US"
}
export declare enum EnumLocale {
ch_de = "ch_DE",
ch_fr = "ch_FR",
ch_it = "ch_it",
de_DE = "de_DE",
it_IT = "it_IT",
fr_FR = "fr_FR",
pt_PT = "pt_PT",
en_US = "en_US"
}
export declare enum EnumTimezone {
EuropeBerlin = "Europe/Berlin",
EuropeLondon = "Europe/London",
EuropeSofia = "Europe/Sofia",
EuropeZurich = "Europe/Zurich",
UTC = "UTC"
}
export declare enum EnumServiceProviderType {
propertyManager = "property-manager",
craftspeople = "craftspeople"
}
export declare enum EnumCommunicationMethodType {
email = "email"
}
export declare enum EnumInputChannel {
APP = "app",
COCKPIT = "cockpit",
CRAFTSMEN = "craftsmen",
EMAIL = "email",
PHONE = "phone",
WHATS_APP = "whats_app"
}
export declare enum EnumLookupUserType {
agent = "agent",
tenant = "tenant"
}
export type EntityResultList<Entity, ExtensionInterface = {}> = Promise<{
readonly _embedded: {
readonly items: readonly Entity[];
};
readonly total: number;
} & ExtensionInterface>;
export interface IAllthingsRestClientOptions {
readonly accessToken?: string;
readonly apiUrl: string;
readonly authorizationCode?: string;
readonly authorizationRedirect?: (url: string) => any;
readonly clientId?: string;
readonly clientSecret?: string;
readonly implicit?: boolean;
readonly oauthUrl: string;
readonly password?: string;
readonly redirectUri?: string;
readonly refreshToken?: string | undefined;
readonly requestBackOffInterval: number;
readonly requestMaxRetries: number;
readonly scope?: string;
readonly serviceName?: string;
readonly state?: string;
readonly tokenStore?: ITokenStore;
readonly username?: string;
}
export interface IClientExposedOAuth {
readonly authorizationCode: {
readonly getUri: (state?: string) => string;
readonly requestToken: (authorizationCode?: string) => ReturnType<TokenRequester>;
};
readonly generateState: () => string;
readonly refreshToken: (refreshToken?: string) => ReturnType<TokenRequester>;
}
export interface IAllthingsRestClient {
readonly delete: MethodHttpDelete;
readonly get: MethodHttpGet;
readonly options: Required<IAllthingsRestClientOptions>;
readonly patch: MethodHttpPatch;
readonly post: MethodHttpPost;
readonly put: MethodHttpPut;
readonly oauth: IClientExposedOAuth;
readonly agentCreate: MethodAgentCreate;
readonly agentCreatePermissions: MethodAgentCreatePermissions;
readonly appCreate: MethodAppCreate;
readonly appGetById: MethodAppGetById;
readonly bucketCreate: MethodBucketCreate;
readonly bucketAddFile: MethodBucketAddFile;
readonly bucketRemoveFile: MethodBucketRemoveFile;
readonly bucketRemoveFilesInPath: MethodBucketRemoveFilesInPath;
readonly bucketGet: MethodBucketGet;
readonly conversationGetById: MethodConversationGetById;
readonly conversationCreateMessage: MethodConversationCreateMessage;
readonly fileCreate: MethodFileCreate;
readonly fileDelete: MethodFileDelete;
readonly lookupIds: MethodLookupIds;
readonly groupCreate: MethodGroupCreate;
readonly groupGetById: MethodGroupGetById;
readonly groupUpdateById: MethodGroupUpdateById;
readonly getUnits: MethodGetUnits;
readonly notificationsGetByUser: MethodNotificationsGetByUser;
readonly notificationsUpdateReadByUser: MethodNotificationsUpdateReadByUser;
readonly notificationUpdateRead: MethodNotificationUpdateRead;
readonly notificationSettingsResetByUser: MethodNotificationSettingsResetByUser;
readonly notificationSettingsUpdateByUser: MethodNotificationSettingsUpdateByUser;
readonly propertyCreate: MethodPropertyCreate;
readonly propertyGetById: MethodPropertyGetById;
readonly propertyUpdateById: MethodPropertyUpdateById;
readonly getProperties: MethodGetProperties;
readonly serviceProviderCreate: MethodServiceProviderCreate;
readonly serviceProviderGetById: MethodServiceProviderGetById;
readonly serviceProviderUpdateById: MethodServiceProviderUpdateById;
readonly registrationCodeCreate: MethodRegistrationCodeCreate;
readonly registrationCodeUpdateById: MethodRegistrationCodeUpdateById;
readonly registrationCodeGetById: MethodRegistrationCodeGetById;
readonly registrationCodeDelete: MethodRegistrationCodeDelete;
readonly ticketCreateOnUser: MethodTicketCreateOnUser;
readonly ticketCreateOnServiceProvider: MethodTicketCreateOnServiceProvider;
readonly ticketGetById: MethodTicketGetById;
readonly unitCreate: MethodUnitCreate;
readonly unitGetById: MethodUnitGetById;
readonly unitUpdateById: MethodUnitUpdateById;
readonly getGroups: MethodGetGroups;
readonly userCreate: MethodUserCreate;
readonly userGetById: MethodUserGetById;
readonly userUpdateById: MethodUserUpdateById;
readonly getUsers: MethodGetUsers;
readonly getCurrentUser: MethodGetCurrentUser;
readonly userChangePassword: MethodUserChangePassword;
readonly userCreatePermission: MethodUserCreatePermission;
readonly userCreatePermissionBatch: MethodUserCreatePermissionBatch;
readonly userGetPermissions: MethodUserGetPermissions;
readonly userDeletePermission: MethodUserDeletePermission;
readonly userGetUtilisationPeriods: MethodUserGetUtilisationPeriods;
readonly userCheckInToUtilisationPeriod: MethodUserCheckInToUtilisationPeriod;
readonly userGetByEmail: MethodUserGetByEmail;
readonly userRelationCreate: MethodUserRelationCreate;
readonly userRelationDelete: MethodUserRelationDelete;
readonly userRelationsGetByUser: MethodUserRelationsGetByUser;
readonly utilisationPeriodCreate: MethodUtilisationPeriodCreate;
readonly utilisationPeriodDelete: MethodUtilisationPeriodDelete;
readonly utilisationPeriodGetById: MethodUtilisationPeriodGetById;
readonly utilisationPeriodUpdateById: MethodUtilisationPeriodUpdateById;
readonly utilisationPeriodCheckInUser: MethodUtilisationPeriodCheckInUser;
readonly utilisationPeriodCheckOutUser: MethodUtilisationPeriodCheckOutUser;
readonly utilisationPeriodAddRegistrationCode: MethodUtilisationPeriodAddRegistrationCode;
readonly bookingGetById: MethodBookingGetById;
readonly bookingUpdateById: MethodBookingUpdateById;
}