/** * API of the server (auto-generated code) */ import { HTTPMimeType, HTTPRequestModel, ModelResponseHttp, RESTCallbacks, RESTConfig, RESTRequestJson, RESTRequestJsonArray, RESTRequestVoid } from "./rest-tools" import { ChangePassword, DataGetToken, GetToken, Long, UserAuth, UserAuthGet, UserCreate, UserOut, isUserAuth, isGetToken, isUserOut, isUserAuthGet, } from "./model" export namespace UserResource { export function changePassword({ restConfig, data, }: { restConfig: RESTConfig, data: ChangePassword, }): Promise { return RESTRequestVoid({ restModel: { endPoint: "/users/password", requestType: HTTPRequestModel.POST, contentType: HTTPMimeType.JSON, }, restConfig, data, }); }; export function create({ restConfig, data, }: { restConfig: RESTConfig, data: UserCreate, }): Promise { return RESTRequestJson({ restModel: { endPoint: "/users", requestType: HTTPRequestModel.POST, contentType: HTTPMimeType.JSON, accept: HTTPMimeType.JSON, }, restConfig, data, }, isUserAuthGet); }; export function getApplicationRight({ restConfig, params, }: { restConfig: RESTConfig, params: { applicationId: Long, userId: Long, }, }): Promise { return RESTRequestJson({ restModel: { endPoint: "/users/{userId}/application/{applicationId}/rights", requestType: HTTPRequestModel.GET, accept: HTTPMimeType.JSON, }, restConfig, params, }, null); }; export function getMe({ restConfig, }: { restConfig: RESTConfig, }): Promise { return RESTRequestJson({ restModel: { endPoint: "/users/me", requestType: HTTPRequestModel.GET, accept: HTTPMimeType.JSON, }, restConfig, }, isUserOut); }; export function getToken({ restConfig, data, }: { restConfig: RESTConfig, data: DataGetToken, }): Promise { return RESTRequestJson({ restModel: { endPoint: "/users/get_token", requestType: HTTPRequestModel.POST, contentType: HTTPMimeType.JSON, accept: HTTPMimeType.JSON, }, restConfig, data, }, isGetToken); }; export function getUser({ restConfig, params, }: { restConfig: RESTConfig, params: { id: Long, }, }): Promise { return RESTRequestJson({ restModel: { endPoint: "/users/{id}", requestType: HTTPRequestModel.GET, accept: HTTPMimeType.JSON, }, restConfig, params, }, isUserAuthGet); }; export function getUsers({ restConfig, }: { restConfig: RESTConfig, }): Promise { return RESTRequestJsonArray({ restModel: { endPoint: "/users", requestType: HTTPRequestModel.GET, accept: HTTPMimeType.JSON, }, restConfig, }, isUserAuthGet); }; export function isEmailExist({ restConfig, queries, }: { restConfig: RESTConfig, queries: { email?: string, }, }): Promise { return RESTRequestJson({ restModel: { endPoint: "/users/is_email_exist", requestType: HTTPRequestModel.GET, accept: HTTPMimeType.JSON, }, restConfig, queries, }, null); }; export function isLoginExist({ restConfig, queries, }: { restConfig: RESTConfig, queries: { login?: string, }, }): Promise { return RESTRequestJson({ restModel: { endPoint: "/users/is_login_exist", requestType: HTTPRequestModel.GET, accept: HTTPMimeType.JSON, }, restConfig, queries, }, null); }; export function linkApplication({ restConfig, params, data, }: { restConfig: RESTConfig, params: { applicationId: Long, userId: Long, }, data: boolean, }): Promise { return RESTRequestJson({ restModel: { endPoint: "/users/{userId}/application/{applicationId}/link", requestType: HTTPRequestModel.POST, accept: HTTPMimeType.JSON, }, restConfig, params, data, }, isUserAuth); }; export function patchApplicationRight({ restConfig, params, data, }: { restConfig: RESTConfig, params: { applicationId: Long, userId: Long, }, data: any, }): Promise { return RESTRequestJson({ restModel: { endPoint: "/users/{userId}/application/{applicationId}/rights", requestType: HTTPRequestModel.PATCH, contentType: HTTPMimeType.JSON, accept: HTTPMimeType.JSON, }, restConfig, params, data, }, null); }; export function setAdmin({ restConfig, params, data, }: { restConfig: RESTConfig, params: { id: Long, }, data: boolean, }): Promise { return RESTRequestVoid({ restModel: { endPoint: "/users/{id}/set_admin", requestType: HTTPRequestModel.POST, contentType: HTTPMimeType.JSON, }, restConfig, params, data, }); }; export function setBlocked({ restConfig, params, data, }: { restConfig: RESTConfig, params: { id: Long, }, data: boolean, }): Promise { return RESTRequestVoid({ restModel: { endPoint: "/users/{id}/set_blocked", requestType: HTTPRequestModel.POST, contentType: HTTPMimeType.JSON, }, restConfig, params, data, }); }; }