// @ts-nocheck /** * This is an auto generate file from fireback project. * You can use this in order to communicate in backend, it gives you available actions, * and their types * Module: workspaces */ import * as workspaces from "../workspaces"; import * as workspaces from "./index"; import { execApiFn, RemoteRequestOption, IDeleteResponse, IResponse, core, ExecApi, IResponseList, } from "../../core/http-tools"; export class UserActions { private _itemsPerPage?: number = undefined; private _startIndex?: number = undefined; private _sort?: number = undefined; private _query?: string = undefined; private _withPreloads?: string = undefined; private _uniqueId?: string = undefined; private _deep?: boolean = undefined; constructor(private apiFn: ExecApi) { this.apiFn = apiFn; } static isUserEntityEqual( a: workspaces.UserEntity, b: workspaces.UserEntity ): boolean { // Change if the primary key is different, or is combined with few fields return a.uniqueId === b.uniqueId; } static getUserEntityPrimaryKey(a: workspaces.UserEntity): string { // Change if the primary key is different, or is combined with few fields return a.uniqueId; } static isUserProfileEntityEqual( a: workspaces.UserProfileEntity, b: workspaces.UserProfileEntity ): boolean { // Change if the primary key is different, or is combined with few fields return a.uniqueId === b.uniqueId; } static getUserProfileEntityPrimaryKey( a: workspaces.UserProfileEntity ): string { // Change if the primary key is different, or is combined with few fields return a.uniqueId; } query(complexSqlAlike: string): UserActions { this._query = complexSqlAlike; return this; } static fn(options: RemoteRequestOption): UserActions { return new UserActions(execApiFn(options)); } static fnExec(fn: ExecApi): UserActions { return new UserActions(fn); } uniqueId(id: string): UserActions { this._uniqueId = id; return this; } deep(deep = true): UserActions { this._deep = deep; return this; } withPreloads(withPreloads: string): UserActions { this._withPreloads = withPreloads; return this; } sort(sortFields: string | string[]): UserActions { this._sort = sortFields; return this; } startIndex(offset: number): UserActions { this._startIndex = offset; return this; } itemsPerPage(limit: number): UserActions { this._itemsPerPage = limit; return this; } get paramsAsString(): string { const q: any = { startIndex: this._startIndex, itemsPerPage: this._itemsPerPage, query: this._query, deep: this._deep, withPreloads: this._withPreloads, uniqueId: this._uniqueId, sort: this._sort, }; const searchParams = new URLSearchParams(); Object.keys(q).forEach((key) => { if (q[key]) { searchParams.append(key, q[key]); } }); return searchParams.toString(); } async patchUser( entity: workspaces.UserEntity ): Promise> { return this.apiFn("PATCH", `user?${this.paramsAsString}`, entity); } async postUser( entity: workspaces.UserEntity ): Promise> { return this.apiFn("POST", `user?${this.paramsAsString}`, entity); } async deleteUser(entity: core.DeleteRequest): Promise { return this.apiFn("DELETE", `user?${this.paramsAsString}`, entity); } async getUsers(): Promise> { return this.apiFn("GET", `users?${this.paramsAsString}`); } async getUserByUniqueId( uniqueId: string ): Promise> { return this.apiFn( "GET", `user/:uniqueId?${this.paramsAsString}`.replace(":uniqueId", uniqueId) ); } async getExchangeKeyByUniqueId( uniqueId: string ): Promise> { return this.apiFn( "GET", `exchangeKey/:uniqueId?${this.paramsAsString}`.replace( ":uniqueId", uniqueId ) ); } async postAuthorization( entity: core.EmptyRequest ): Promise> { return this.apiFn("POST", `authorization?${this.paramsAsString}`, entity); } async getprofile(): Promise> { return this.apiFn("GET", `profile?${this.paramsAsString}`); } async postprofile( entity: workspaces.UserProfileEntity ): Promise> { return this.apiFn("POST", `profile?${this.paramsAsString}`, entity); } async deleteAuthRevoke(entity: core.DeleteRequest): Promise { return this.apiFn("DELETE", `auth/revoke?${this.paramsAsString}`, entity); } async postPreferences(entity: any): Promise { return this.apiFn("POST", `preferences?${this.paramsAsString}`, entity); } async getPreferences(): Promise { return this.apiFn("GET", `preferences?${this.paramsAsString}`); } }