diff --git a/src/generated/backend/Client.ts b/src/generated/backend/Client.ts index 868d9cee..71a16087 100644 --- a/src/generated/backend/Client.ts +++ b/src/generated/backend/Client.ts @@ -21,6 +21,7 @@ import {PlanTag} from "./PlanTag"; import {PageTag} from "./PageTag"; import {MarketplaceTag} from "./MarketplaceTag"; import {LogTag} from "./LogTag"; +import {IdentityTag} from "./IdentityTag"; import {GeneratorTag} from "./GeneratorTag"; import {EventTag} from "./EventTag"; import {DashboardTag} from "./DashboardTag"; @@ -146,6 +147,14 @@ export class Client extends ClientAbstract { ); } + public identity(): IdentityTag + { + return new IdentityTag( + this.httpClient, + this.parser + ); + } + public generator(): GeneratorTag { return new GeneratorTag( diff --git a/src/generated/backend/Identity.ts b/src/generated/backend/Identity.ts new file mode 100644 index 00000000..916af8b0 --- /dev/null +++ b/src/generated/backend/Identity.ts @@ -0,0 +1,22 @@ +/** + * Identity automatically generated by SDKgen please do not edit this file manually + * {@link https://sdkgen.app} + */ + +export interface Identity { + id?: number + appId?: number + roleId?: number + name?: string + icon?: string + class?: string + clientId?: string + clientSecret?: string + authorizationUri?: string + tokenUri?: string + userInfoUri?: string + idProperty?: string + nameProperty?: string + emailProperty?: string + allowCreate?: boolean +} diff --git a/src/generated/backend/IdentityCollection.ts b/src/generated/backend/IdentityCollection.ts new file mode 100644 index 00000000..b81bc62d --- /dev/null +++ b/src/generated/backend/IdentityCollection.ts @@ -0,0 +1,8 @@ +/** + * IdentityCollection automatically generated by SDKgen please do not edit this file manually + * {@link https://sdkgen.app} + */ + +import {Collection} from "./Collection"; +import {Identity} from "./Identity"; +export type IdentityCollection = Collection; diff --git a/src/generated/backend/IdentityCreate.ts b/src/generated/backend/IdentityCreate.ts new file mode 100644 index 00000000..dd8b9725 --- /dev/null +++ b/src/generated/backend/IdentityCreate.ts @@ -0,0 +1,8 @@ +/** + * IdentityCreate automatically generated by SDKgen please do not edit this file manually + * {@link https://sdkgen.app} + */ + +import {Identity} from "./Identity"; +export interface IdentityCreate extends Identity { +} diff --git a/src/generated/backend/IdentityTag.ts b/src/generated/backend/IdentityTag.ts new file mode 100644 index 00000000..fa82a7b9 --- /dev/null +++ b/src/generated/backend/IdentityTag.ts @@ -0,0 +1,228 @@ +/** + * IdentityTag automatically generated by SDKgen please do not edit this file manually + * {@link https://sdkgen.app} + */ + +import axios, {AxiosRequestConfig} from "axios"; +import {TagAbstract} from "sdkgen-client" +import {ClientException, UnknownStatusCodeException} from "sdkgen-client"; + +import {Identity} from "./Identity"; +import {IdentityCollection} from "./IdentityCollection"; +import {IdentityCreate} from "./IdentityCreate"; +import {IdentityUpdate} from "./IdentityUpdate"; +import {Message} from "./Message"; +import {MessageException} from "./MessageException"; + +export class IdentityTag extends TagAbstract { + /** + * @returns {Promise} + * @throws {MessageException} + * @throws {ClientException} + */ + public async delete(identityId: string): Promise { + const url = this.parser.url('/backend/identity/$identity_id<[0-9]+|^~>', { + 'identity_id': identityId, + }); + + let params: AxiosRequestConfig = { + url: url, + method: 'DELETE', + params: this.parser.query({ + }), + }; + + try { + const response = await this.httpClient.request(params); + return response.data; + } catch (error) { + if (error instanceof ClientException) { + throw error; + } else if (axios.isAxiosError(error) && error.response) { + switch (error.response.status) { + case 401: + throw new MessageException(error.response.data); + case 404: + throw new MessageException(error.response.data); + case 410: + throw new MessageException(error.response.data); + case 500: + throw new MessageException(error.response.data); + default: + throw new UnknownStatusCodeException('The server returned an unknown status code'); + } + } else { + throw new ClientException('An unknown error occurred: ' + String(error)); + } + } + } + + /** + * @returns {Promise} + * @throws {MessageException} + * @throws {ClientException} + */ + public async update(identityId: string, payload: IdentityUpdate): Promise { + const url = this.parser.url('/backend/identity/$identity_id<[0-9]+|^~>', { + 'identity_id': identityId, + }); + + let params: AxiosRequestConfig = { + url: url, + method: 'PUT', + params: this.parser.query({ + }), + data: payload + }; + + try { + const response = await this.httpClient.request(params); + return response.data; + } catch (error) { + if (error instanceof ClientException) { + throw error; + } else if (axios.isAxiosError(error) && error.response) { + switch (error.response.status) { + case 400: + throw new MessageException(error.response.data); + case 401: + throw new MessageException(error.response.data); + case 404: + throw new MessageException(error.response.data); + case 410: + throw new MessageException(error.response.data); + case 500: + throw new MessageException(error.response.data); + default: + throw new UnknownStatusCodeException('The server returned an unknown status code'); + } + } else { + throw new ClientException('An unknown error occurred: ' + String(error)); + } + } + } + + /** + * @returns {Promise} + * @throws {MessageException} + * @throws {ClientException} + */ + public async get(identityId: string): Promise { + const url = this.parser.url('/backend/identity/$identity_id<[0-9]+|^~>', { + 'identity_id': identityId, + }); + + let params: AxiosRequestConfig = { + url: url, + method: 'GET', + params: this.parser.query({ + }), + }; + + try { + const response = await this.httpClient.request(params); + return response.data; + } catch (error) { + if (error instanceof ClientException) { + throw error; + } else if (axios.isAxiosError(error) && error.response) { + switch (error.response.status) { + case 401: + throw new MessageException(error.response.data); + case 404: + throw new MessageException(error.response.data); + case 410: + throw new MessageException(error.response.data); + case 500: + throw new MessageException(error.response.data); + default: + throw new UnknownStatusCodeException('The server returned an unknown status code'); + } + } else { + throw new ClientException('An unknown error occurred: ' + String(error)); + } + } + } + + /** + * @returns {Promise} + * @throws {MessageException} + * @throws {ClientException} + */ + public async create(payload: IdentityCreate): Promise { + const url = this.parser.url('/backend/identity', { + }); + + let params: AxiosRequestConfig = { + url: url, + method: 'POST', + params: this.parser.query({ + }), + data: payload + }; + + try { + const response = await this.httpClient.request(params); + return response.data; + } catch (error) { + if (error instanceof ClientException) { + throw error; + } else if (axios.isAxiosError(error) && error.response) { + switch (error.response.status) { + case 400: + throw new MessageException(error.response.data); + case 401: + throw new MessageException(error.response.data); + case 500: + throw new MessageException(error.response.data); + default: + throw new UnknownStatusCodeException('The server returned an unknown status code'); + } + } else { + throw new ClientException('An unknown error occurred: ' + String(error)); + } + } + } + + /** + * @returns {Promise} + * @throws {MessageException} + * @throws {ClientException} + */ + public async getAll(startIndex?: number, count?: number, search?: string): Promise { + const url = this.parser.url('/backend/identity', { + }); + + let params: AxiosRequestConfig = { + url: url, + method: 'GET', + params: this.parser.query({ + 'startIndex': startIndex, + 'count': count, + 'search': search, + }), + }; + + try { + const response = await this.httpClient.request(params); + return response.data; + } catch (error) { + if (error instanceof ClientException) { + throw error; + } else if (axios.isAxiosError(error) && error.response) { + switch (error.response.status) { + case 401: + throw new MessageException(error.response.data); + case 500: + throw new MessageException(error.response.data); + default: + throw new UnknownStatusCodeException('The server returned an unknown status code'); + } + } else { + throw new ClientException('An unknown error occurred: ' + String(error)); + } + } + } + + +} diff --git a/src/generated/backend/IdentityUpdate.ts b/src/generated/backend/IdentityUpdate.ts new file mode 100644 index 00000000..c3cf699a --- /dev/null +++ b/src/generated/backend/IdentityUpdate.ts @@ -0,0 +1,8 @@ +/** + * IdentityUpdate automatically generated by SDKgen please do not edit this file manually + * {@link https://sdkgen.app} + */ + +import {Identity} from "./Identity"; +export interface IdentityUpdate extends Identity { +} diff --git a/src/generated/consumer/AccountTag.ts b/src/generated/consumer/AccountTag.ts index d56657ff..addc6d39 100644 --- a/src/generated/consumer/AccountTag.ts +++ b/src/generated/consumer/AccountTag.ts @@ -19,7 +19,6 @@ import {UserEmail} from "./UserEmail"; import {UserJWT} from "./UserJWT"; import {UserLogin} from "./UserLogin"; import {UserPasswordReset} from "./UserPasswordReset"; -import {UserProvider} from "./UserProvider"; import {UserRefresh} from "./UserRefresh"; import {UserRegister} from "./UserRegister"; @@ -138,45 +137,6 @@ export class AccountTag extends TagAbstract { } } - /** - * @returns {Promise} - * @throws {MessageException} - * @throws {ClientException} - */ - public async provider(provider: string, payload: UserProvider): Promise { - const url = this.parser.url('/consumer/provider/:provider', { - 'provider': provider, - }); - - let params: AxiosRequestConfig = { - url: url, - method: 'POST', - params: this.parser.query({ - }), - data: payload - }; - - try { - const response = await this.httpClient.request(params); - return response.data; - } catch (error) { - if (error instanceof ClientException) { - throw error; - } else if (axios.isAxiosError(error) && error.response) { - switch (error.response.status) { - case 400: - throw new MessageException(error.response.data); - case 500: - throw new MessageException(error.response.data); - default: - throw new UnknownStatusCodeException('The server returned an unknown status code'); - } - } else { - throw new ClientException('An unknown error occurred: ' + String(error)); - } - } - } - /** * @returns {Promise} * @throws {MessageException} diff --git a/src/generated/consumer/Client.ts b/src/generated/consumer/Client.ts index 2ebcf3fa..ee03a42e 100644 --- a/src/generated/consumer/Client.ts +++ b/src/generated/consumer/Client.ts @@ -7,6 +7,7 @@ import axios, {AxiosRequestConfig} from "axios"; import {ClientAbstract, TokenStoreInterface} from "sdkgen-client" import {ClientException, UnknownStatusCodeException} from "sdkgen-client"; +import {IdentityTag} from "./IdentityTag"; import {AccountTag} from "./AccountTag"; import {TransactionTag} from "./TransactionTag"; import {SubscriptionTag} from "./SubscriptionTag"; @@ -20,6 +21,14 @@ import {EventTag} from "./EventTag"; import {AppTag} from "./AppTag"; export class Client extends ClientAbstract { + public identity(): IdentityTag + { + return new IdentityTag( + this.httpClient, + this.parser + ); + } + public account(): AccountTag { return new AccountTag( diff --git a/src/generated/consumer/IdentityTag.ts b/src/generated/consumer/IdentityTag.ts new file mode 100644 index 00000000..ccdae5fe --- /dev/null +++ b/src/generated/consumer/IdentityTag.ts @@ -0,0 +1,130 @@ +/** + * IdentityTag automatically generated by SDKgen please do not edit this file manually + * {@link https://sdkgen.app} + */ + +import axios, {AxiosRequestConfig} from "axios"; +import {TagAbstract} from "sdkgen-client" +import {ClientException, UnknownStatusCodeException} from "sdkgen-client"; + +import {Message} from "./Message"; +import {MessageException} from "./MessageException"; +import {UserJWT} from "./UserJWT"; + +export class IdentityTag extends TagAbstract { + /** + * @returns {Promise} + * @throws {MessageException} + * @throws {ClientException} + */ + public async redirect(identity: string): Promise { + const url = this.parser.url('/consumer/identity/:identity/redirect', { + 'identity': identity, + }); + + let params: AxiosRequestConfig = { + url: url, + method: 'GET', + params: this.parser.query({ + }), + }; + + try { + const response = await this.httpClient.request(params); + return response.data; + } catch (error) { + if (error instanceof ClientException) { + throw error; + } else if (axios.isAxiosError(error) && error.response) { + switch (error.response.status) { + case 400: + throw new MessageException(error.response.data); + case 500: + throw new MessageException(error.response.data); + default: + throw new UnknownStatusCodeException('The server returned an unknown status code'); + } + } else { + throw new ClientException('An unknown error occurred: ' + String(error)); + } + } + } + + /** + * @returns {Promise} + * @throws {MessageException} + * @throws {ClientException} + */ + public async exchange(identity: string): Promise { + const url = this.parser.url('/consumer/identity/:identity/exchange', { + 'identity': identity, + }); + + let params: AxiosRequestConfig = { + url: url, + method: 'GET', + params: this.parser.query({ + }), + }; + + try { + const response = await this.httpClient.request(params); + return response.data; + } catch (error) { + if (error instanceof ClientException) { + throw error; + } else if (axios.isAxiosError(error) && error.response) { + switch (error.response.status) { + case 400: + throw new MessageException(error.response.data); + case 500: + throw new MessageException(error.response.data); + default: + throw new UnknownStatusCodeException('The server returned an unknown status code'); + } + } else { + throw new ClientException('An unknown error occurred: ' + String(error)); + } + } + } + + /** + * @returns {Promise} + * @throws {MessageException} + * @throws {ClientException} + */ + public async getAll(appId?: number): Promise { + const url = this.parser.url('/consumer/identity', { + }); + + let params: AxiosRequestConfig = { + url: url, + method: 'GET', + params: this.parser.query({ + 'appId': appId, + }), + }; + + try { + const response = await this.httpClient.request(params); + return response.data; + } catch (error) { + if (error instanceof ClientException) { + throw error; + } else if (axios.isAxiosError(error) && error.response) { + switch (error.response.status) { + case 400: + throw new MessageException(error.response.data); + case 500: + throw new MessageException(error.response.data); + default: + throw new UnknownStatusCodeException('The server returned an unknown status code'); + } + } else { + throw new ClientException('An unknown error occurred: ' + String(error)); + } + } + } + + +} diff --git a/src/generated/consumer/UserProvider.ts b/src/generated/consumer/UserProvider.ts deleted file mode 100644 index 2d652999..00000000 --- a/src/generated/consumer/UserProvider.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * UserProvider automatically generated by SDKgen please do not edit this file manually - * {@link https://sdkgen.app} - */ - -export interface UserProvider { - code?: string - clientId?: string - redirectUri?: string -}