/* eslint-disable */ /* tslint:disable */ /* * --------------------------------------------------------------- * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## * ## ## * ## AUTHOR: acacode ## * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## * --------------------------------------------------------------- */ export interface AccountDetailRespond { id?: string | null; dialCode?: string | null; email?: string | null; userName?: string | null; phone?: string | null; problems?: Record; } export interface AccountListsRequest { /** @format int32 */ page?: number; /** @format int32 */ pageSize?: number; } export interface AccountListsResponse { /** @format int32 */ page?: number; /** @format int32 */ pageSize?: number; nextPageExist?: boolean; /** @format int32 */ lastPageNum?: number; accountsDetail?: AccountDetailRespond[] | null; } export interface AddClaimsToUserModel { userId?: string | null; issuer?: string | null; newClaims?: Record; } export interface AddClaimsToUserReturnModel { userId?: string | null; isSucess?: boolean; error?: string | null; allUserClaims?: Record; } export interface AddRoleToUserModel { /** * @minLength 1 * @maxLength 40 */ userIdentify?: string | null; /** * @minLength 1 * @maxLength 40 */ roleIdentify?: string | null; } export interface ChangeEmailRequest { newEmail?: string | null; } export interface ChangeEmailRespond { newEmail?: string | null; oldEmail?: string | null; valSuccess?: boolean; updateSuccess?: boolean; problems?: Record; } export interface ChangePassword { password?: string | null; newPassword1?: string | null; newPassword2?: string | null; logOutAllSession?: boolean; } export interface ChangePasswordReturn { isSuccess?: boolean; mess?: string | null; /** @format int32 */ lockedTokenCount?: number; } export interface ChangePhoneNumberRequest { prefix?: string | null; number?: string | null; } export interface ChangePhoneNumberRespond { prefix?: string | null; number?: string | null; oldPrefix?: string | null; oldPhone?: string | null; valSuccess?: boolean; updateSuccess?: boolean; problems?: Record; } export interface CreatePrivilageModel { privilage?: string | null; } export interface CreateRoleModel { name?: string | null; privilage?: string[] | null; forcePrivilage?: boolean; } export interface CreateServicePrivilageResult { privilage?: string | null; isCreated?: boolean | null; } export interface CreateServiceRoleResult { isSuccessed?: boolean; errors?: Record; } export interface CreateServiceTokenModel { serviceName?: string | null; servicePrivilages?: string[] | null; serviceRoles?: RoleModel[] | null; issuer?: string | null; } export interface CreateServiceTokenReturnModel { serviceName?: string | null; serviceUsername?: string | null; isSuccess?: boolean; userAllereadyExist?: boolean; serviceToken?: string | null; privilageResults?: CreateServicePrivilageResult[] | null; roleResults?: CreateServiceRoleResult[] | null; } export interface CreateUserModel { username?: string | null; password?: string | null; email?: string | null; phone?: string | null; dialcode?: string | null; roles?: string[] | null; } export interface CreateUserModelReturn { username?: string | null; password?: string | null; email?: string | null; phone?: string | null; dialcode?: string | null; roles?: RoleStatus[] | null; returnMess?: string | null; newUserId?: string | null; isCreated?: boolean; } export interface DeactiveTokenModel { token?: string | null; } export interface DeleteRoleModel { roleIdentify?: string | null; } export interface DeleteUserRequestModel { userId?: string | null; } export interface DeleteUserReturnModel { userId?: string | null; operationMessage?: string | null; isOperationSuccess?: boolean; /** @format int32 */ dedeltedTokenCount?: number; } export interface EditAccountRequest { userId?: string | null; newUserName?: string | null; newEmail?: string | null; newDialCode?: string | null; newPhone?: string | null; } export interface EditAccountRespond { userId?: string | null; newUserName?: string | null; newEmail?: string | null; newDialCode?: string | null; newPhone?: string | null; /** @default false */ userNameEdited?: boolean; /** @default false */ emailEdited?: boolean; /** @default false */ phoneEdited?: boolean; /** @default false */ success?: boolean; message?: string | null; } export interface EditRoleModel { roleIdentify?: string | null; /** @default false */ forceAddedPrivilage?: boolean; addPrivilage?: string[] | null; deletePrivilage?: string[] | null; newName?: string | null; } export interface Jwk { kty?: string | null; e?: string | null; n?: string | null; use?: string | null; alg?: string | null; kid?: string | null; } export interface JwksResponse { keys?: Jwk[] | null; } export interface LogOutModel { logOutSuccess?: boolean; mess?: string | null; } export interface LoginModel { login?: string | null; email?: string | null; token?: string | null; /** @format int64 */ exp?: number; message?: string | null; accountProblem?: string | null; isLogged?: boolean; requiresTwoFactor?: boolean; } export interface LoginRequestModel { /** @minLength 1 */ login: string; /** @minLength 1 */ pass: string; } export interface OkModel { message?: string | null; isSuccess?: boolean; value?: any; } export interface OpenIdConfiguration { issuer?: string | null; authorizationEndpoint?: string | null; tokenEndpoint?: string | null; jwksUri?: string | null; responseTypesSupported?: string[] | null; subjectTypesSupported?: string[] | null; idTokenSigningAlgValuesSupported?: string[] | null; } export interface PingModel { message?: string | null; /** @format int64 */ time?: number; } export interface RegeneratedTokenModel { token?: string | null; mess?: string | null; } export interface RegisterModel { registerToken?: string | null; username?: string | null; email?: string | null; password?: string | null; roles?: string[] | null; } export interface RegisterReturnModel { isCreated?: boolean; authToken?: string | null; problemWithUsername?: string | null; problemWitbEmail?: string | null; problemWithPassword?: string | null; problemWithToken?: string | null; otherWithOtherProblem?: string | null; } export interface RoleListModel { roles?: RoleModel[] | null; } export interface RoleModel { roleName?: string | null; /** @default false */ isGlobalAdmin?: boolean; privilage?: string[] | null; } export interface RoleStatus { exist?: boolean; added?: boolean; name?: string | null; mess?: string | null; } export interface TokenAskIfIsLockModel { token?: string | null; } export interface UserRoleModel { userId?: string | null; username?: string | null; roles?: RoleModel[] | null; } export interface UserRoleReqestModel { userIdentify?: string | null; } export type QueryParamsType = Record; export type ResponseFormat = keyof Omit; export interface FullRequestParams extends Omit { /** set parameter to `true` for call `securityWorker` for this request */ secure?: boolean; /** request path */ path: string; /** content type of request body */ type?: ContentType; /** query params */ query?: QueryParamsType; /** format of response (i.e. response.json() -> format: "json") */ format?: ResponseFormat; /** request body */ body?: unknown; /** base url */ baseUrl?: string; /** request cancellation token */ cancelToken?: CancelToken; } export type RequestParams = Omit; export interface ApiConfig { baseUrl?: string; baseApiParams?: Omit; securityWorker?: (securityData: SecurityDataType | null) => Promise | RequestParams | void; customFetch?: typeof fetch; } export interface HttpResponse extends Response { data: D; error: E; } type CancelToken = Symbol | string | number; export enum ContentType { Json = "application/json", FormData = "multipart/form-data", UrlEncoded = "application/x-www-form-urlencoded", Text = "text/plain", } export class HttpClient { public baseUrl: string = "/auth/"; private securityData: SecurityDataType | null = null; private securityWorker?: ApiConfig["securityWorker"]; private abortControllers = new Map(); private customFetch = (...fetchParams: Parameters) => fetch(...fetchParams); private baseApiParams: RequestParams = { credentials: "same-origin", headers: {}, redirect: "follow", referrerPolicy: "no-referrer", }; constructor(apiConfig: ApiConfig = {}) { Object.assign(this, apiConfig); } public setSecurityData = (data: SecurityDataType | null) => { this.securityData = data; }; protected encodeQueryParam(key: string, value: any) { const encodedKey = encodeURIComponent(key); return `${encodedKey}=${encodeURIComponent(typeof value === "number" ? value : `${value}`)}`; } protected addQueryParam(query: QueryParamsType, key: string) { return this.encodeQueryParam(key, query[key]); } protected addArrayQueryParam(query: QueryParamsType, key: string) { const value = query[key]; return value.map((v: any) => this.encodeQueryParam(key, v)).join("&"); } protected toQueryString(rawQuery?: QueryParamsType): string { const query = rawQuery || {}; const keys = Object.keys(query).filter((key) => "undefined" !== typeof query[key]); return keys .map((key) => (Array.isArray(query[key]) ? this.addArrayQueryParam(query, key) : this.addQueryParam(query, key))) .join("&"); } protected addQueryParams(rawQuery?: QueryParamsType): string { const queryString = this.toQueryString(rawQuery); return queryString ? `?${queryString}` : ""; } private contentFormatters: Record any> = { [ContentType.Json]: (input: any) => input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, [ContentType.Text]: (input: any) => (input !== null && typeof input !== "string" ? JSON.stringify(input) : input), [ContentType.FormData]: (input: any) => Object.keys(input || {}).reduce((formData, key) => { const property = input[key]; formData.append( key, property instanceof Blob ? property : typeof property === "object" && property !== null ? JSON.stringify(property) : `${property}`, ); return formData; }, new FormData()), [ContentType.UrlEncoded]: (input: any) => this.toQueryString(input), }; protected mergeRequestParams(params1: RequestParams, params2?: RequestParams): RequestParams { return { ...this.baseApiParams, ...params1, ...(params2 || {}), headers: { ...(this.baseApiParams.headers || {}), ...(params1.headers || {}), ...((params2 && params2.headers) || {}), }, }; } protected createAbortSignal = (cancelToken: CancelToken): AbortSignal | undefined => { if (this.abortControllers.has(cancelToken)) { const abortController = this.abortControllers.get(cancelToken); if (abortController) { return abortController.signal; } return void 0; } const abortController = new AbortController(); this.abortControllers.set(cancelToken, abortController); return abortController.signal; }; public abortRequest = (cancelToken: CancelToken) => { const abortController = this.abortControllers.get(cancelToken); if (abortController) { abortController.abort(); this.abortControllers.delete(cancelToken); } }; public request = async ({ body, secure, path, type, query, format, baseUrl, cancelToken, ...params }: FullRequestParams): Promise> => { const secureParams = ((typeof secure === "boolean" ? secure : this.baseApiParams.secure) && this.securityWorker && (await this.securityWorker(this.securityData))) || {}; const requestParams = this.mergeRequestParams(params, secureParams); const queryString = query && this.toQueryString(query); const payloadFormatter = this.contentFormatters[type || ContentType.Json]; const responseFormat = format || requestParams.format; return this.customFetch(`${baseUrl || this.baseUrl || ""}${path}${queryString ? `?${queryString}` : ""}`, { ...requestParams, headers: { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; const data = !responseFormat ? r : await response[responseFormat]() .then((data) => { if (r.ok) { r.data = data; } else { r.error = data; } return r; }) .catch((e) => { r.error = e; return r; }); if (cancelToken) { this.abortControllers.delete(cancelToken); } if (!response.ok) throw data; return data; }); }; } /** * @title OpenWarehouse.auth.api * @version 1.0 * @baseUrl /auth/ */ export class Api extends HttpClient { account = { /** * No description * * @tags Account * @name DeleteUserDelete * @request DELETE:/Account/DeleteUser * @secure */ deleteUserDelete: (data: DeleteUserRequestModel, params: RequestParams = {}) => this.request({ path: `/Account/DeleteUser`, method: "DELETE", body: data, secure: true, type: ContentType.Json, format: "json", ...params, }), /** * No description * * @tags Account * @name CreateUserCreate * @request POST:/Account/CreateUser * @secure */ createUserCreate: (data: CreateUserModel, params: RequestParams = {}) => this.request({ path: `/Account/CreateUser`, method: "POST", body: data, secure: true, type: ContentType.Json, format: "json", ...params, }), /** * No description * * @tags Account * @name ChangePasswordCreate * @request POST:/Account/ChangePassword * @secure */ changePasswordCreate: (data: ChangePassword, params: RequestParams = {}) => this.request({ path: `/Account/ChangePassword`, method: "POST", body: data, secure: true, type: ContentType.Json, format: "json", ...params, }), /** * No description * * @tags Account * @name DeactivateTokenCreate * @request POST:/Account/DeactivateToken * @secure */ deactivateTokenCreate: (data: DeactiveTokenModel, params: RequestParams = {}) => this.request({ path: `/Account/DeactivateToken`, method: "POST", body: data, secure: true, type: ContentType.Json, format: "json", ...params, }), /** * No description * * @tags Account * @name AddClaimsToUserCreate * @request POST:/Account/AddClaimsToUser * @secure */ addClaimsToUserCreate: (data: AddClaimsToUserModel, params: RequestParams = {}) => this.request({ path: `/Account/AddClaimsToUser`, method: "POST", body: data, secure: true, type: ContentType.Json, format: "json", ...params, }), /** * No description * * @tags Account * @name GetAllClaimsUserList * @request GET:/Account/GetAllClaimsUser * @secure */ getAllClaimsUserList: (params: RequestParams = {}) => this.request({ path: `/Account/GetAllClaimsUser`, method: "GET", secure: true, format: "json", ...params, }), /** * No description * * @tags Account * @name UpdateUserEmailCreate * @request POST:/Account/UpdateUserEmail * @secure */ updateUserEmailCreate: (data: ChangeEmailRequest, params: RequestParams = {}) => this.request({ path: `/Account/UpdateUserEmail`, method: "POST", body: data, secure: true, type: ContentType.Json, format: "json", ...params, }), /** * No description * * @tags Account * @name UpdatePhoneNumberCreate * @request POST:/Account/UpdatePhoneNumber * @secure */ updatePhoneNumberCreate: (data: ChangePhoneNumberRequest, params: RequestParams = {}) => this.request({ path: `/Account/UpdatePhoneNumber`, method: "POST", body: data, secure: true, type: ContentType.Json, format: "json", ...params, }), /** * No description * * @tags Account * @name GetMyDetailCreate * @request POST:/Account/GetMyDetail * @secure */ getMyDetailCreate: (params: RequestParams = {}) => this.request({ path: `/Account/GetMyDetail`, method: "POST", secure: true, format: "json", ...params, }), /** * No description * * @tags Account * @name GetListOfUsersCreate * @request POST:/Account/GetListOfUsers * @secure */ getListOfUsersCreate: (data: AccountListsRequest, params: RequestParams = {}) => this.request({ path: `/Account/GetListOfUsers`, method: "POST", body: data, secure: true, type: ContentType.Json, format: "json", ...params, }), /** * No description * * @tags Account * @name EditAccountCreate * @request POST:/Account/EditAccount * @secure */ editAccountCreate: (data: EditAccountRequest, params: RequestParams = {}) => this.request({ path: `/Account/EditAccount`, method: "POST", body: data, secure: true, type: ContentType.Json, format: "json", ...params, }), }; login = { /** * No description * * @tags Auth * @name LoginCreate * @request POST:/Login * @secure */ loginCreate: (data: LoginRequestModel, params: RequestParams = {}) => this.request({ path: `/Login`, method: "POST", body: data, secure: true, type: ContentType.Json, format: "json", ...params, }), }; register = { /** * No description * * @tags Auth * @name RegisterCreate * @request POST:/Register * @secure */ registerCreate: (data: RegisterModel, params: RequestParams = {}) => this.request({ path: `/Register`, method: "POST", body: data, secure: true, type: ContentType.Json, format: "json", ...params, }), }; logOut = { /** * No description * * @tags Auth * @name LogOutList * @request GET:/LogOut * @secure */ logOutList: (params: RequestParams = {}) => this.request({ path: `/LogOut`, method: "GET", secure: true, format: "json", ...params, }), }; regenerateToken = { /** * No description * * @tags Auth * @name RegenerateTokenList * @request GET:/RegenerateToken * @secure */ regenerateTokenList: (params: RequestParams = {}) => this.request({ path: `/RegenerateToken`, method: "GET", secure: true, format: "json", ...params, }), }; deleteExpiredToken = { /** * No description * * @tags Auth * @name DeleteExpiredTokenDelete * @request DELETE:/DeleteExpiredToken * @secure */ deleteExpiredTokenDelete: (params: RequestParams = {}) => this.request({ path: `/DeleteExpiredToken`, method: "DELETE", secure: true, format: "json", ...params, }), }; tokenIsLock = { /** * No description * * @tags Auth * @name TokenIsLockCreate * @request POST:/TokenIsLock * @secure */ tokenIsLockCreate: (data: TokenAskIfIsLockModel, params: RequestParams = {}) => this.request({ path: `/TokenIsLock`, method: "POST", body: data, secure: true, type: ContentType.Json, format: "json", ...params, }), }; privilege = { /** * No description * * @tags Privilege * @name GetUserPrivilegeCreate * @request POST:/Privilege/GetUserPrivilege * @secure */ getUserPrivilegeCreate: (params: RequestParams = {}) => this.request({ path: `/Privilege/GetUserPrivilege`, method: "POST", secure: true, format: "json", ...params, }), /** * No description * * @tags Privilege * @name CreatePrivilageCreate * @request POST:/Privilege/CreatePrivilage * @secure */ createPrivilageCreate: (data: CreatePrivilageModel, params: RequestParams = {}) => this.request({ path: `/Privilege/CreatePrivilage`, method: "POST", body: data, secure: true, type: ContentType.Json, ...params, }), }; role = { /** * No description * * @tags Role * @name GetRolesCreate * @request POST:/Role/GetRoles * @secure */ getRolesCreate: (params: RequestParams = {}) => this.request({ path: `/Role/GetRoles`, method: "POST", secure: true, format: "json", ...params, }), /** * No description * * @tags Role * @name GetUserRolesCreate * @request POST:/Role/GetUserRoles * @secure */ getUserRolesCreate: (data: UserRoleReqestModel, params: RequestParams = {}) => this.request({ path: `/Role/GetUserRoles`, method: "POST", body: data, secure: true, type: ContentType.Json, format: "json", ...params, }), /** * No description * * @tags Role * @name CreateRoleCreate * @request POST:/Role/CreateRole * @secure */ createRoleCreate: (data: CreateRoleModel, params: RequestParams = {}) => this.request({ path: `/Role/CreateRole`, method: "POST", body: data, secure: true, type: ContentType.Json, format: "json", ...params, }), /** * No description * * @tags Role * @name AddRoleToUserCreate * @request POST:/Role/AddRoleToUser * @secure */ addRoleToUserCreate: (data: AddRoleToUserModel, params: RequestParams = {}) => this.request({ path: `/Role/AddRoleToUser`, method: "POST", body: data, secure: true, type: ContentType.Json, format: "json", ...params, }), /** * No description * * @tags Role * @name EditRolePrivilageCreate * @request POST:/Role/EditRolePrivilage * @secure */ editRolePrivilageCreate: (data: EditRoleModel, params: RequestParams = {}) => this.request({ path: `/Role/EditRolePrivilage`, method: "POST", body: data, secure: true, type: ContentType.Json, format: "json", ...params, }), /** * No description * * @tags Role * @name DeleteRoleDelete * @request DELETE:/Role/DeleteRole * @secure */ deleteRoleDelete: (data: DeleteRoleModel, params: RequestParams = {}) => this.request({ path: `/Role/DeleteRole`, method: "DELETE", body: data, secure: true, type: ContentType.Json, format: "json", ...params, }), }; service = { /** * No description * * @tags Service * @name GetTokenForServiceCreate * @request POST:/Service/GetTokenForService * @secure */ getTokenForServiceCreate: (data: CreateServiceTokenModel, params: RequestParams = {}) => this.request({ path: `/Service/GetTokenForService`, method: "POST", body: data, secure: true, type: ContentType.Json, format: "json", ...params, }), /** * No description * * @tags Service * @name TestServiceTokenCreate * @request POST:/Service/TestServiceToken * @secure */ testServiceTokenCreate: (params: RequestParams = {}) => this.request({ path: `/Service/TestServiceToken`, method: "POST", secure: true, format: "json", ...params, }), }; ping = { /** * No description * * @tags Tools * @name PingList * @request GET:/Ping * @secure */ pingList: (params: RequestParams = {}) => this.request({ path: `/Ping`, method: "GET", secure: true, format: "json", ...params, }), }; testAuthStatus = { /** * No description * * @tags Tools * @name TestAuthStatusList * @request GET:/TestAuthStatus * @secure */ testAuthStatusList: (params: RequestParams = {}) => this.request({ path: `/TestAuthStatus`, method: "GET", secure: true, format: "json", ...params, }), }; wellKnown = { /** * No description * * @tags WellKnown * @name OpenidConfigurationList * @request GET:/.well-known/openid-configuration * @secure */ openidConfigurationList: (params: RequestParams = {}) => this.request({ path: `/.well-known/openid-configuration`, method: "GET", secure: true, format: "json", ...params, }), /** * No description * * @tags WellKnown * @name JwksList * @request GET:/.well-known/jwks * @secure */ jwksList: (params: RequestParams = {}) => this.request({ path: `/.well-known/jwks`, method: "GET", secure: true, format: "json", ...params, }), }; }