import { HttpClient } from '@angular/common/http'; import { HTTP } from '@awesome-cordova-plugins/http/ngx'; import { Subscription } from 'rxjs'; import { GetOptions } from '../interfaces/ff.interface'; import { Thing, ThingSearchFilters } from '../interfaces/things/thing.interface'; import { LibConfig, ProfileConfig } from '../lib.service'; import { MetaThing } from '../interfaces/things/meta-thing/meta-thing.interface'; import { FFUser, IFFUser, IOrganization, IRole, Organization, Profile } from '../interfaces/user-role-organization/user.interface'; import { Credentials } from '../interfaces/user-role-organization/credentials.interface'; import { RegistrationInvite } from '../interfaces/user-role-organization/registration-invite.interface'; import { RoleGuid } from '../interfaces/user-role-organization/role.interface'; import { IUserRelation } from '../interfaces/user-role-organization/user-relation.interface'; import { SupportReply } from '../interfaces/things/support/support.interface'; import { SentNotification, SentNotificationSearchFilters } from '../interfaces/things/notifications/notification.interface'; import { Clazz } from '../interfaces/ff-const'; import { FormSchedule } from '../interfaces/things/forms/form-schedules/form-schedule.interface'; import { Configuration } from '../interfaces/configuration.interface'; export declare class ApiService { config: LibConfig; http: HTTP; ngHttp: HttpClient; name: string; prefix: string; apiUrl: string; custom: any; profileConfig: ProfileConfig; assetURL: string; thingDownloadURL: string; constructor(config: LibConfig, http: HTTP, ngHttp: HttpClient); get serviceUrl(): string; getItem(name: string): any; setItem(name: string, data: any): void; removeItem(name: string): void; clear(): void; get user(): any; set user(data: any); get profiles(): Profile[]; set profiles(profiles: Profile[]); get activeProfile(): string; set activeProfile(profileGuid: string); get activeProfileOrg(): Organization; get activeProfileRole(): IRole; encodeURI(s: string): string; getHttpParams(params?: any): any; getCordovaHttpParams(params?: { [key: string]: string | string[]; }): { [key: string]: string | string[]; }; getHttpHeaders(headers?: { [index: string]: string; }): any; get(url: string, headers?: { [index: string]: string; }, params?: any): Promise; getFile(url: string, params?: any): Subscription; post(url: string, body: any, headers?: { [index: string]: string; }, params?: any): Promise; put(url: string, body: any, headers?: { [index: string]: string; }, params?: any): Promise; cordovaPut(url: string, body: any, serializer?: 'urlencoded' | 'json' | 'utf8' | 'multipart' | 'raw'): Promise; delete(url: string, headers?: { [index: string]: string; }, params?: any): Promise; private getThingQuery; private getThingQueryParams; private getThingQueryFilters; /** * get objects from the Thing collection * @param {ThingSearchFilters} searchFilters - the search filters * @param {GetOptions} getOptions - the get options * @param {boolean} [onlyChildren] - if true will only get the objects in /things grabbag of queried Things */ getThings(searchFilters: ThingSearchFilters, getOptions: GetOptions, onlyChildren?: boolean): Promise>; /** * get one object from the Thing collection with the provided guid * @param {string} guid - the Thing guid * @param {GetOptions} getOptions - the get options */ getThingByGuid(guid: string, getOptions: GetOptions): Promise; /** * Remove the childThings from the parentThing things grabbag * i.e. remove the relation between parent and child things * @param {string} parentThing - the parent Thing guid that has the things grabbag * @param {string[]} childThings - the child Thing guids that will be removed from the grabbag */ removeThings(parentThing: string, childThings: string[]): Promise; addThing(data: any): Promise; updateThing(data: any): Promise; deleteThing(guid: string): Promise; duplicateThing(guid: string): Promise>; downloadThing(guid: string, getOptions: GetOptions): Subscription; downloadThings(searchFilters: ThingSearchFilters, getOptions: GetOptions): Subscription; getThingCount(searchFilters: ThingSearchFilters, getOptions: GetOptions): Promise; /** * Get a set of Things of type 'MetaThing' that are used to describe the types and subtypes of Things * @param {string} thingTypes - the type(s) of Things that you want descriptors of. * @param {string[]} thingSubTypes - the subtype(s) of Things that you want descriptors of. */ getThingTypeDescriptor(thingTypes?: string | string[], thingSubTypes?: string | string[], getOptions?: GetOptions, onlyChildren?: boolean): Promise; uploadAssetFile(guid: string, fileData: FormData): Promise; uploadAssetFileByCordova(guid: string, fileData: FormData): Promise; deleteAssetFile(guid: string): Promise; /** * Get an object decribing the current user and profile permissions to perform operations on objects of the clazz * @param {Clazz} clazz - the clazz * @param {string} type - if clazz is 'Thing' you can get specific permissions for a Thing type * @param {string} method - get the permissions for a specific operation. if no method is provided all operations are informed */ getClazzPermissions(clazz: Clazz, type?: string, method?: 'create' | 'read' | 'update' | 'delete'): Promise; validSession(): Promise; getSessionUser(): Promise; login(credentials: Credentials, org?: string, role?: string): Promise; logout(data?: any): Promise; setUserProfiles(userProfiles: Array): void; getUserProfiles(): Array; getUser(): IFFUser; getActiveProfile(): Profile; setActiveProfile(profileGuid: string): void; currentUserHasProfileInOrg(orgGuid: string): boolean; currentUserHasProfileInCdh(): boolean; register(data: any): Promise; changePassword(password: string): Promise; recoverPassword(email: string, organization: string): Promise; useRecover(data: any): Promise; addRegistrationInvite(data: any): Promise; getRegistrationInvite(guid: any): Promise>; getActiveRegistrationInvites(orgGuid?: string, start?: number, count?: number): Promise>; useRegistrationInvite(guid: any, user: IFFUser, password: string): Promise; updateRegistrationInvite(data: any): Promise; addProfile(data: any): Promise; deleteProfile(guid: string): Promise; getLoggedUserProfiles(role?: string, org?: string, includeChildOrg?: boolean): Promise>; getUsers(guid?: string): Promise; getUsersOfRole(roleGuid: RoleGuid): Promise; createInactiveUser(orgGuid: string, roles: string[], userGuidPrefix: string, user?: FFUser): Promise; activateUser(userGuid: string, email: string, orgGuid: string): Promise; getOrganizations(getOptions: GetOptions): Promise>; getOrganization(guid: string, getOptions: GetOptions): Promise; addOrganization(data: any): Promise; updateOrganization(data: any): Promise; deleteOrganization(guid: string): Promise; getRoles(): Promise>; getUserRelations(relation?: string, userFrom?: string, userTo?: string): Promise>; addUserRelation(data: any): Promise; deleteUserRelation(guid: string): Promise; /** * Get the value of a configuration. * * Configurations are used to store different values of a certain property (identified by a key) for different organizations. * * Configurations follow the hierarchical nature of organizations in the way that if a child organization does not have a configuration for a certain key, it will assume the value of the closest parent organization that has one. * * Certain configurations can be acessed anonymously (without authentication) Org param is mandatory if the request is anonymous. * * If request is not anonymous, org can be provided to get the configuration value for the specific organization if user has access to it. * * If request is not anonymous, org is not provided and activeProfile is being used, the org is inferred from the activeProfile. Otherwise, all user profiles will be considered. * * If org is not provided, activeProfile is not being used, and the user has multiple profiles in different organizations it won't be possible to retrieve the value * @param {string} confKey - the configuration key * @param {string} org - the organization guid of the configuration. * */ getConfigurationForOrganization(confKey: string, org?: string): Promise; activeOrgConfigurations: { [confKey: string]: Configuration; }; sendSupportReplyByEmail(reply: SupportReply): Promise; private getSentNotificationQuery; private getSentNotificationQueryParams; private getSentNotificationQueryFilters; getSentNotificationsForUser(searchFilters: SentNotificationSearchFilters, getOptions: GetOptions): Promise>; /** * Returns array of Form Schedules that can be answered by the current user because their date has been reached yet they haven't expired * * Does not take into account the status or existence of any related Form Entry (i.e. doesn't exclude Form Schedules that have been answered) * */ getAvailableFormSchedulesForUser(): Promise>; getRegexForInsensitiveSearch(name: string): string; parseFilenameFromContentDispositionHeader(disposition: string): string; }