// @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 WorkspaceActions { 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 isWorkspaceInviteEntityEqual( a: workspaces.WorkspaceInviteEntity, b: workspaces.WorkspaceInviteEntity ): boolean { // Change if the primary key is different, or is combined with few fields return a.uniqueId === b.uniqueId; } static getWorkspaceInviteEntityPrimaryKey( a: workspaces.WorkspaceInviteEntity ): string { // Change if the primary key is different, or is combined with few fields return a.uniqueId; } static isWorkspaceEntityEqual( a: workspaces.WorkspaceEntity, b: workspaces.WorkspaceEntity ): boolean { // Change if the primary key is different, or is combined with few fields return a.uniqueId === b.uniqueId; } static getWorkspaceEntityPrimaryKey(a: workspaces.WorkspaceEntity): string { // Change if the primary key is different, or is combined with few fields return a.uniqueId; } query(complexSqlAlike: string): WorkspaceActions { this._query = complexSqlAlike; return this; } static fn(options: RemoteRequestOption): WorkspaceActions { return new WorkspaceActions(execApiFn(options)); } static fnExec(fn: ExecApi): WorkspaceActions { return new WorkspaceActions(fn); } uniqueId(id: string): WorkspaceActions { this._uniqueId = id; return this; } deep(deep = true): WorkspaceActions { this._deep = deep; return this; } withPreloads(withPreloads: string): WorkspaceActions { this._withPreloads = withPreloads; return this; } sort(sortFields: string | string[]): WorkspaceActions { this._sort = sortFields; return this; } startIndex(offset: number): WorkspaceActions { this._startIndex = offset; return this; } itemsPerPage(limit: number): WorkspaceActions { 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 postWorkspaceInvite( entity: workspaces.WorkspaceInviteEntity ): Promise> { return this.apiFn( "POST", `workspace/invite?${this.paramsAsString}`, entity ); } async getWorkspaceByUniqueId( uniqueId: string ): Promise> { return this.apiFn( "GET", `workspace/:uniqueId?action=GetWorkspaceAction&${this.paramsAsString}`.replace( ":uniqueId", uniqueId ) ); } async patchWorkspace( entity: workspaces.WorkspaceEntity ): Promise> { return this.apiFn("PATCH", `workspace?${this.paramsAsString}`, entity); } async patchWorkspaceInvite( entity: workspaces.WorkspaceEntity ): Promise> { return this.apiFn( "PATCH", `workspace/invite?${this.paramsAsString}`, entity ); } async postWorkspaceAcceptInvite( entity: workspaces.AcceptInviteDto ): Promise> { return this.apiFn( "POST", `workspace/acceptInvite?${this.paramsAsString}`, entity ); } async getWorkspaces(): Promise> { return this.apiFn("GET", `workspaces?${this.paramsAsString}`); } async getUserRoleWorkspaces(): Promise< IResponseList > { return this.apiFn( "GET", `userRoleWorkspaces?action=GetUserWorkspacesAndRolesAction&${this.paramsAsString}` ); } async postWorkspace( entity: workspaces.WorkspaceEntity ): Promise> { return this.apiFn("POST", `workspace?${this.paramsAsString}`, entity); } async patchWorkspaceConfig( entity: workspaces.WorkspaceConfigDto ): Promise> { return this.apiFn( "PATCH", `workspace/config?${this.paramsAsString}`, entity ); } async getWorkspaceConfig(): Promise< IResponse > { return this.apiFn("GET", `workspace/config?${this.paramsAsString}`); } async deleteWorkspace(entity: core.DeleteRequest): Promise { return this.apiFn("DELETE", `workspace?${this.paramsAsString}`, entity); } async deleteWorkspaceInvite( entity: core.DeleteRequest ): Promise { return this.apiFn( "DELETE", `workspace/invite?${this.paramsAsString}`, entity ); } async getWorkspaceInvites(): Promise< IResponseList > { return this.apiFn("GET", `workspace/invites?${this.paramsAsString}`); } async getUserInvites(): Promise< IResponseList > { return this.apiFn("GET", `user/invites?${this.paramsAsString}`); } }