-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
422 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<Identity>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<Message>} | ||
* @throws {MessageException} | ||
* @throws {ClientException} | ||
*/ | ||
public async delete(identityId: string): Promise<Message> { | ||
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<Message>(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<Message>} | ||
* @throws {MessageException} | ||
* @throws {ClientException} | ||
*/ | ||
public async update(identityId: string, payload: IdentityUpdate): Promise<Message> { | ||
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<Message>(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<Identity>} | ||
* @throws {MessageException} | ||
* @throws {ClientException} | ||
*/ | ||
public async get(identityId: string): Promise<Identity> { | ||
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<Identity>(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<Message>} | ||
* @throws {MessageException} | ||
* @throws {ClientException} | ||
*/ | ||
public async create(payload: IdentityCreate): Promise<Message> { | ||
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<Message>(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<IdentityCollection>} | ||
* @throws {MessageException} | ||
* @throws {ClientException} | ||
*/ | ||
public async getAll(startIndex?: number, count?: number, search?: string): Promise<IdentityCollection> { | ||
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<IdentityCollection>(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)); | ||
} | ||
} | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.