I wanted to use OpenAPI 3 to generate the axios typescript client I use for my project, mainly to use the same enum by reference, rather than having multiple instances being generated (this works fine).
For this, I've changed following references.
Before:
<PackageReference Include="Swashbuckle.AspNetCore" Version="4.0.1" />
<PackageReference Include="Swashbuckle.AspNetCore.Filters" Version="4.5.5" />
After:
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.0.0-rc4" />
<PackageReference Include="Swashbuckle.AspNetCore.Filters" Version="5.0.0-rc8" />
I use cake for the generation, but the generation is the same when using NswagStudio.
With: #addin nuget:?package=Cake.CodeGen.NSwag&version=1.2.0&loaddependencies=true
Before:
Task ("Frontend-Generate-API-Client")
.Does (() => {
var settings = new TypeScriptClientGeneratorSettings {
ClassName = "{controller}Client",
Template = TypeScriptTemplate.Axios,
OperationNameGenerator = new MultipleClientsFromFirstTagAndOperationIdGenerator (),
ExceptionClass = "ApiException",
GenerateDtoTypes = true
};
NSwag.FromJsonSpecification (new Uri (localApiUri))
.GenerateTypeScriptClient (apiClientFilePath, settings);
Information ($"The client API has been updated in '{apiClientFilePath}'");
});
After:
Task ("Frontend-Generate-API-Client")
.Does (() => {
var settings = new TypeScriptClientGeneratorSettings {
ClassName = "{controller}Client",
Template = TypeScriptTemplate.Axios,
OperationNameGenerator = new MultipleClientsFromFirstTagAndOperationIdGenerator(),
ExceptionClass = "ApiException",
GenerateDtoTypes = true,
CodeGeneratorSettings = {
SchemaType = NJsonSchema.SchemaType.OpenApi3
}
};
NSwag.FromJsonSpecification (new Uri (localApiUri))
.GenerateTypeScriptClient (apiClientFilePath, settings);
Information ($"The client API has been updated in '{apiClientFilePath}'");
});
Now the method names in the client aren't being generate as before. Here's an example:
Before: getUserByUserId(id: string): Promise<UserResponseDto> {...}
After: users4(id: string): Promise<UserResponseDto> {...}
Here's the commit including all relevant changes. It can easily be tested and reproduced with it, if needed.
What do I have to change in order to have _nice_ method names again?
How do the generated operationId s look like? They should be in the form controllerName_methodName
@RicoSuter You can see the differences here:
The exapmle for the methods I've mentioned above:
OpenApi 2:
export class UsersClient {
[...]
/**
* Gets the user
* @param id The user identifier
* @return Success
*/
getUserByUserId(id: string): Promise<UserResponseDto> {
let url_ = this.baseUrl + "/users/{id}";
if (id === undefined || id === null)
throw new Error("The parameter 'id' must be defined.");
url_ = url_.replace("{id}", encodeURIComponent("" + id));
url_ = url_.replace(/[?&]$/, "");
let options_ = <AxiosRequestConfig>{
method: "GET",
url: url_,
headers: {
"Accept": "application/json"
}
};
return this.instance.request(options_).then((_response: AxiosResponse) => {
return this.processGetUserByUserId(_response);
});
}
OpenApi 3:
export class UsersClient {
[...]
/**
* Gets the user
* @param id The user identifier
* @return Success
*/
users4(id: string): Promise<UserResponseDto> {
let url_ = this.baseUrl + "/users/{id}";
if (id === undefined || id === null)
throw new Error("The parameter 'id' must be defined.");
url_ = url_.replace("{id}", encodeURIComponent("" + id));
url_ = url_.replace(/[?&]$/, "");
let options_ = <AxiosRequestConfig>{
method: "GET",
url: url_,
headers: {
"Accept": "text/plain"
}
};
return this.instance.request(options_).then((_response: AxiosResponse) => {
return this.processUsers4(_response);
});
}
}
Are you sure you are still using nswag in the v3 case? Can you also provide the generated specs?
Yes, I'm sure.
For automated api client generation, I use Cake.CodeGen.NSwag 1.2.0, which references Nswag 13.0.3 with
Task ("Frontend-Generate-API-Client")
.Does (() => {
var settings = new TypeScriptClientGeneratorSettings {
ClassName = "{controller}Client",
Template = TypeScriptTemplate.Axios,
OperationNameGenerator = new MultipleClientsFromFirstTagAndOperationIdGenerator(),
ExceptionClass = "ApiException",
GenerateDtoTypes = true,
CodeGeneratorSettings = {
SchemaType = NJsonSchema.SchemaType.OpenApi3
}
};
NSwag.FromJsonSpecification (new Uri (localApiUri))
.GenerateTypeScriptClient (apiClientFilePath, settings);
Information ($"The client API has been updated in '{apiClientFilePath}'");
});
I've tried with the current NswagStudio master (8da7d846144a4) and generating an axios typescript client with MultipleClientsFromFirstTagAndOperationId, it generates following.
For input:
{
"openapi": "3.0.1",
"info": {
"title": "Sppd.TeamTuner",
"version": "v1"
},
"paths": {
"/administration/system-info": {
"get": {
"tags": [
"Administration"
],
"summary": "Gets the system information containing the version, GIT commit hash and build time.",
"responses": {
"200": {
"description": "Success",
"content": {
"text/plain": {
"schema": {
"$ref": "#/components/schemas/SystemInfoDto"
}
},
"application/json": {
"schema": {
"$ref": "#/components/schemas/SystemInfoDto"
}
},
"text/json": {
"schema": {
"$ref": "#/components/schemas/SystemInfoDto"
}
}
}
}
}
}
},
"/card-levels": {
"put": {
"tags": [
"CardLevels"
],
"summary": "Sets the card level for the given user and card",
"requestBody": {
"description": "The card level update",
"content": {
"application/json-patch+json": {
"schema": {
"$ref": "#/components/schemas/CardLevelUpdateRequestDto"
}
},
"application/json": {
"schema": {
"$ref": "#/components/schemas/CardLevelUpdateRequestDto"
}
},
"text/json": {
"schema": {
"$ref": "#/components/schemas/CardLevelUpdateRequestDto"
}
},
"application/*+json": {
"schema": {
"$ref": "#/components/schemas/CardLevelUpdateRequestDto"
}
}
}
},
"responses": {
"200": {
"description": "Success",
"content": {
"text/plain": {
"schema": {
"$ref": "#/components/schemas/CardLevelResponseDto"
}
},
"application/json": {
"schema": {
"$ref": "#/components/schemas/CardLevelResponseDto"
}
},
"text/json": {
"schema": {
"$ref": "#/components/schemas/CardLevelResponseDto"
}
}
}
},
"401": {
"description": "Unauthorized"
},
"403": {
"description": "Forbidden"
}
},
"security": [
{
"oauth2": []
}
]
}
},
"/cards": {
"get": {
"tags": [
"Cards"
],
"summary": "Gets all the cards",
"responses": {
"200": {
"description": "Success",
"content": {
"text/plain": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/CardResponseDto"
}
}
},
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/CardResponseDto"
}
}
},
"text/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/CardResponseDto"
}
}
}
}
}
}
}
},
"/core-data/card-types": {
"get": {
"tags": [
"CoreData"
],
"summary": "Gets all card types (Spell, Spawn, Character)",
"responses": {
"200": {
"description": "Success",
"content": {
"text/plain": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/CardTypeResponseDto"
}
}
},
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/CardTypeResponseDto"
}
}
},
"text/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/CardTypeResponseDto"
}
}
}
}
}
}
}
},
"/core-data/character-types": {
"get": {
"tags": [
"CoreData"
],
"summary": "Gets all character types (Assassin, Melee...)",
"responses": {
"200": {
"description": "Success",
"content": {
"text/plain": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/CharacterTypeResponseDto"
}
}
},
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/CharacterTypeResponseDto"
}
}
},
"text/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/CharacterTypeResponseDto"
}
}
}
}
}
}
}
},
"/core-data/rarities": {
"get": {
"tags": [
"CoreData"
],
"summary": "Gets all rarities (Common, Rare...)",
"responses": {
"200": {
"description": "Success",
"content": {
"text/plain": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/RarityResponseDto"
}
}
},
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/RarityResponseDto"
}
}
},
"text/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/RarityResponseDto"
}
}
}
}
}
}
}
},
"/core-data/themes": {
"get": {
"tags": [
"CoreData"
],
"summary": "Gets all themes (Sci-fy, Fantasy...)",
"responses": {
"200": {
"description": "Success",
"content": {
"text/plain": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/ThemeResponseDto"
}
}
},
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/ThemeResponseDto"
}
}
},
"text/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/ThemeResponseDto"
}
}
}
}
}
}
}
},
"/email-verification/{code}/verify": {
"get": {
"tags": [
"EmailVerification"
],
"summary": "Verifies the email with the given code.",
"parameters": [
{
"name": "code",
"in": "path",
"description": "The code.",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Success",
"content": {
"text/plain": {
"schema": {
"type": "boolean"
}
},
"application/json": {
"schema": {
"type": "boolean"
}
},
"text/json": {
"schema": {
"type": "boolean"
}
}
}
}
}
}
},
"/email-verification/{code}/resend": {
"get": {
"tags": [
"EmailVerification"
],
"summary": "Sends a previously sent verification email.",
"parameters": [
{
"name": "code",
"in": "path",
"description": "The code.",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Success"
}
}
}
},
"/team-membership-requests": {
"post": {
"tags": [
"TeamMembershipRequests"
],
"summary": "Requests membership in a team for a user",
"requestBody": {
"description": "The membership request for a user to join a team",
"content": {
"application/json-patch+json": {
"schema": {
"$ref": "#/components/schemas/TeamMembershipRequestDto"
}
},
"application/json": {
"schema": {
"$ref": "#/components/schemas/TeamMembershipRequestDto"
}
},
"text/json": {
"schema": {
"$ref": "#/components/schemas/TeamMembershipRequestDto"
}
},
"application/*+json": {
"schema": {
"$ref": "#/components/schemas/TeamMembershipRequestDto"
}
}
}
},
"responses": {
"200": {
"description": "Success"
},
"401": {
"description": "Unauthorized"
},
"403": {
"description": "Forbidden"
}
},
"security": [
{
"oauth2": []
}
]
},
"get": {
"tags": [
"TeamMembershipRequests"
],
"summary": "Gets the pending team membership request for the user.",
"parameters": [
{
"name": "userId",
"in": "query",
"description": "The user identifier.",
"schema": {
"type": "string",
"format": "uuid"
}
}
],
"responses": {
"200": {
"description": "Success",
"content": {
"text/plain": {
"schema": {
"$ref": "#/components/schemas/TeamMembershipRequestResponseDto"
}
},
"application/json": {
"schema": {
"$ref": "#/components/schemas/TeamMembershipRequestResponseDto"
}
},
"text/json": {
"schema": {
"$ref": "#/components/schemas/TeamMembershipRequestResponseDto"
}
}
}
},
"401": {
"description": "Unauthorized"
},
"403": {
"description": "Forbidden"
}
},
"security": [
{
"oauth2": []
}
]
}
},
"/team-membership-requests/{id}/accept": {
"post": {
"tags": [
"TeamMembershipRequests"
],
"summary": "Accepts the membership request",
"parameters": [
{
"name": "id",
"in": "path",
"description": "The membership request identifier",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
],
"responses": {
"200": {
"description": "Success"
},
"401": {
"description": "Unauthorized"
},
"403": {
"description": "Forbidden"
}
},
"security": [
{
"oauth2": []
}
]
}
},
"/team-membership-requests/{id}/reject": {
"post": {
"tags": [
"TeamMembershipRequests"
],
"summary": "Rejects the membership request",
"parameters": [
{
"name": "id",
"in": "path",
"description": "The membership request identifier",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
],
"responses": {
"200": {
"description": "Success"
},
"401": {
"description": "Unauthorized"
},
"403": {
"description": "Forbidden"
}
},
"security": [
{
"oauth2": []
}
]
}
},
"/team-membership-requests/{id}/abort": {
"post": {
"tags": [
"TeamMembershipRequests"
],
"summary": "Aborts the membership request",
"parameters": [
{
"name": "id",
"in": "path",
"description": "The membership request identifier",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
],
"responses": {
"200": {
"description": "Success"
},
"401": {
"description": "Unauthorized"
},
"403": {
"description": "Forbidden"
}
},
"security": [
{
"oauth2": []
}
]
}
},
"/teams": {
"post": {
"tags": [
"Teams"
],
"summary": "Creates a new team",
"requestBody": {
"description": "The team creation request",
"content": {
"application/json-patch+json": {
"schema": {
"$ref": "#/components/schemas/TeamCreateRequestDto"
}
},
"application/json": {
"schema": {
"$ref": "#/components/schemas/TeamCreateRequestDto"
}
},
"text/json": {
"schema": {
"$ref": "#/components/schemas/TeamCreateRequestDto"
}
},
"application/*+json": {
"schema": {
"$ref": "#/components/schemas/TeamCreateRequestDto"
}
}
}
},
"responses": {
"200": {
"description": "Success",
"content": {
"text/plain": {
"schema": {
"$ref": "#/components/schemas/TeamResponseDto"
}
},
"application/json": {
"schema": {
"$ref": "#/components/schemas/TeamResponseDto"
}
},
"text/json": {
"schema": {
"$ref": "#/components/schemas/TeamResponseDto"
}
}
}
},
"401": {
"description": "Unauthorized"
},
"403": {
"description": "Forbidden"
}
},
"security": [
{
"oauth2": []
}
]
},
"put": {
"tags": [
"Teams"
],
"summary": "Updates the team",
"requestBody": {
"description": "The team update request",
"content": {
"application/json-patch+json": {
"schema": {
"$ref": "#/components/schemas/TeamUpdateRequestDto"
}
},
"application/json": {
"schema": {
"$ref": "#/components/schemas/TeamUpdateRequestDto"
}
},
"text/json": {
"schema": {
"$ref": "#/components/schemas/TeamUpdateRequestDto"
}
},
"application/*+json": {
"schema": {
"$ref": "#/components/schemas/TeamUpdateRequestDto"
}
}
}
},
"responses": {
"200": {
"description": "Success",
"content": {
"text/plain": {
"schema": {
"$ref": "#/components/schemas/TeamResponseDto"
}
},
"application/json": {
"schema": {
"$ref": "#/components/schemas/TeamResponseDto"
}
},
"text/json": {
"schema": {
"$ref": "#/components/schemas/TeamResponseDto"
}
}
}
},
"401": {
"description": "Unauthorized"
},
"403": {
"description": "Forbidden"
}
},
"security": [
{
"oauth2": []
}
]
},
"get": {
"tags": [
"Teams"
],
"summary": "Get all teams containing the specified name in their name.",
"parameters": [
{
"name": "name",
"in": "query",
"description": "The name having to be contained in the team name.",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Success",
"content": {
"text/plain": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/TeamResponseDto"
}
}
},
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/TeamResponseDto"
}
}
},
"text/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/TeamResponseDto"
}
}
}
}
}
}
}
},
"/teams/{id}": {
"delete": {
"tags": [
"Teams"
],
"summary": "Deletes the team",
"parameters": [
{
"name": "id",
"in": "path",
"description": "The team identifier",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
],
"responses": {
"200": {
"description": "Success"
},
"401": {
"description": "Unauthorized"
},
"403": {
"description": "Forbidden"
}
},
"security": [
{
"oauth2": []
}
]
},
"get": {
"tags": [
"Teams"
],
"summary": "Gets the team",
"parameters": [
{
"name": "id",
"in": "path",
"description": "The team identifier",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
],
"responses": {
"200": {
"description": "Success",
"content": {
"text/plain": {
"schema": {
"$ref": "#/components/schemas/TeamResponseDto"
}
},
"application/json": {
"schema": {
"$ref": "#/components/schemas/TeamResponseDto"
}
},
"text/json": {
"schema": {
"$ref": "#/components/schemas/TeamResponseDto"
}
}
}
},
"401": {
"description": "Unauthorized"
},
"403": {
"description": "Forbidden"
}
},
"security": [
{
"oauth2": []
}
]
}
},
"/teams/{id}/members": {
"get": {
"tags": [
"Teams"
],
"summary": "Gets the team members.",
"parameters": [
{
"name": "id",
"in": "path",
"description": "The team identifier",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
],
"responses": {
"200": {
"description": "Success",
"content": {
"text/plain": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/UserResponseDto"
}
}
},
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/UserResponseDto"
}
}
},
"text/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/UserResponseDto"
}
}
}
}
},
"401": {
"description": "Unauthorized"
},
"403": {
"description": "Forbidden"
}
},
"security": [
{
"oauth2": []
}
]
}
},
"/teams/{id}/membership-requests": {
"get": {
"tags": [
"Teams"
],
"summary": "Gets the membership requests.",
"parameters": [
{
"name": "id",
"in": "path",
"description": "The team identifier",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
],
"responses": {
"200": {
"description": "Success",
"content": {
"text/plain": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/TeamMembershipRequestResponseDto"
}
}
},
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/TeamMembershipRequestResponseDto"
}
}
},
"text/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/TeamMembershipRequestResponseDto"
}
}
}
}
},
"401": {
"description": "Unauthorized"
},
"403": {
"description": "Forbidden"
}
},
"security": [
{
"oauth2": []
}
]
}
},
"/users": {
"post": {
"tags": [
"Users"
],
"summary": "Creates a new user",
"description": "As stated by its name, the client has to send the MD5 hash of the password (length=36). This MD5 hash will be\r\nstored as salted hash in the DB.",
"requestBody": {
"description": "The user creation request",
"content": {
"application/json-patch+json": {
"schema": {
"$ref": "#/components/schemas/UserCreateRequestDto"
}
},
"application/json": {
"schema": {
"$ref": "#/components/schemas/UserCreateRequestDto"
}
},
"text/json": {
"schema": {
"$ref": "#/components/schemas/UserCreateRequestDto"
}
},
"application/*+json": {
"schema": {
"$ref": "#/components/schemas/UserCreateRequestDto"
}
}
}
},
"responses": {
"200": {
"description": "Success",
"content": {
"text/plain": {
"schema": {
"$ref": "#/components/schemas/UserResponseDto"
}
},
"application/json": {
"schema": {
"$ref": "#/components/schemas/UserResponseDto"
}
},
"text/json": {
"schema": {
"$ref": "#/components/schemas/UserResponseDto"
}
}
}
}
}
},
"put": {
"tags": [
"Users"
],
"summary": "Updates the user",
"description": "If the PropertiesToUpdate have been specified, only these will be updated; otherwise, all properties will be\r\nupdated.",
"requestBody": {
"description": "The user update request",
"content": {
"application/json-patch+json": {
"schema": {
"$ref": "#/components/schemas/UserUpdateRequestDto"
}
},
"application/json": {
"schema": {
"$ref": "#/components/schemas/UserUpdateRequestDto"
}
},
"text/json": {
"schema": {
"$ref": "#/components/schemas/UserUpdateRequestDto"
}
},
"application/*+json": {
"schema": {
"$ref": "#/components/schemas/UserUpdateRequestDto"
}
}
}
},
"responses": {
"200": {
"description": "Success",
"content": {
"text/plain": {
"schema": {
"$ref": "#/components/schemas/UserResponseDto"
}
},
"application/json": {
"schema": {
"$ref": "#/components/schemas/UserResponseDto"
}
},
"text/json": {
"schema": {
"$ref": "#/components/schemas/UserResponseDto"
}
}
}
},
"401": {
"description": "Unauthorized"
},
"403": {
"description": "Forbidden"
}
},
"security": [
{
"oauth2": []
}
]
}
},
"/users/{id}/leaveTeam": {
"put": {
"tags": [
"Users"
],
"summary": "Leave the team the user is currently in.",
"parameters": [
{
"name": "id",
"in": "path",
"description": "The user identifier.",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
],
"responses": {
"200": {
"description": "Success",
"content": {
"text/plain": {
"schema": {
"$ref": "#/components/schemas/UserResponseDto"
}
},
"application/json": {
"schema": {
"$ref": "#/components/schemas/UserResponseDto"
}
},
"text/json": {
"schema": {
"$ref": "#/components/schemas/UserResponseDto"
}
}
}
},
"401": {
"description": "Unauthorized"
},
"403": {
"description": "Forbidden"
}
},
"security": [
{
"oauth2": []
}
]
}
},
"/users/authorize": {
"post": {
"tags": [
"Users"
],
"summary": "Authorizes the user",
"description": "The response contains a token which has to be included as bearer token in the HTTP authorization header for\r\nsubsequent calls to API methods requiring authentication.",
"requestBody": {
"description": "The authorization request",
"content": {
"application/json-patch+json": {
"schema": {
"$ref": "#/components/schemas/AuthorizationRequestDto"
}
},
"application/json": {
"schema": {
"$ref": "#/components/schemas/AuthorizationRequestDto"
}
},
"text/json": {
"schema": {
"$ref": "#/components/schemas/AuthorizationRequestDto"
}
},
"application/*+json": {
"schema": {
"$ref": "#/components/schemas/AuthorizationRequestDto"
}
}
}
},
"responses": {
"200": {
"description": "Success",
"content": {
"text/plain": {
"schema": {
"$ref": "#/components/schemas/UserAuthorizationResponseDto"
}
},
"application/json": {
"schema": {
"$ref": "#/components/schemas/UserAuthorizationResponseDto"
}
},
"text/json": {
"schema": {
"$ref": "#/components/schemas/UserAuthorizationResponseDto"
}
}
}
}
}
}
},
"/users/{id}": {
"delete": {
"tags": [
"Users"
],
"summary": "Deletes the user",
"parameters": [
{
"name": "id",
"in": "path",
"description": "The user identifier",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
],
"responses": {
"200": {
"description": "Success"
},
"401": {
"description": "Unauthorized"
},
"403": {
"description": "Forbidden"
}
},
"security": [
{
"oauth2": []
}
]
},
"get": {
"tags": [
"Users"
],
"summary": "Gets the user",
"parameters": [
{
"name": "id",
"in": "path",
"description": "The user identifier",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
],
"responses": {
"200": {
"description": "Success",
"content": {
"text/plain": {
"schema": {
"$ref": "#/components/schemas/UserResponseDto"
}
},
"application/json": {
"schema": {
"$ref": "#/components/schemas/UserResponseDto"
}
},
"text/json": {
"schema": {
"$ref": "#/components/schemas/UserResponseDto"
}
}
}
},
"401": {
"description": "Unauthorized"
},
"403": {
"description": "Forbidden"
}
},
"security": [
{
"oauth2": []
}
]
}
},
"/users/{id}/card-levels": {
"get": {
"tags": [
"Users"
],
"summary": "Gets all card levels having been set for the user",
"parameters": [
{
"name": "id",
"in": "path",
"description": "The user identifier",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
],
"responses": {
"200": {
"description": "Success",
"content": {
"text/plain": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/CardLevelResponseDto"
}
}
},
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/CardLevelResponseDto"
}
}
},
"text/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/CardLevelResponseDto"
}
}
}
}
},
"401": {
"description": "Unauthorized"
},
"403": {
"description": "Forbidden"
}
},
"security": [
{
"oauth2": []
}
]
}
},
"/users/{id}/cards": {
"get": {
"tags": [
"Users"
],
"summary": "Gets all existing cards and includes the level for the user if it has been set",
"parameters": [
{
"name": "id",
"in": "path",
"description": "The user identifier",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
],
"responses": {
"200": {
"description": "Success",
"content": {
"text/plain": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/UserCardResponseDto"
}
}
},
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/UserCardResponseDto"
}
}
},
"text/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/UserCardResponseDto"
}
}
}
}
},
"401": {
"description": "Unauthorized"
},
"403": {
"description": "Forbidden"
}
},
"security": [
{
"oauth2": []
}
]
}
}
},
"components": {
"schemas": {
"SystemInfoDto": {
"required": [
"version"
],
"type": "object",
"properties": {
"version": {
"type": "string",
"nullable": true
},
"gitCommitHash": {
"type": "string",
"nullable": true
},
"buildTimeUtc": {
"type": "string",
"format": "date-time",
"nullable": true
}
},
"additionalProperties": false
},
"CardLevelUpdateRequestDto": {
"required": [
"cardId",
"level",
"userId"
],
"type": "object",
"properties": {
"userId": {
"type": "string",
"description": "The user identifier",
"format": "uuid"
},
"cardId": {
"type": "string",
"description": "The card identifier",
"format": "uuid"
},
"level": {
"maximum": 7,
"minimum": 1,
"type": "integer",
"description": "The level of the card for the user (1-7).",
"format": "int32"
}
},
"additionalProperties": false
},
"CardLevelResponseDto": {
"required": [
"cardId",
"id",
"level",
"userId"
],
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "The card level identifier",
"format": "uuid"
},
"userId": {
"type": "string",
"description": "The user identifier",
"format": "uuid"
},
"cardId": {
"type": "string",
"description": "The card identifier",
"format": "uuid"
},
"level": {
"maximum": 7,
"minimum": 1,
"type": "integer",
"description": "The level of the card for the user",
"format": "int32"
},
"levelLastModified": {
"type": "string",
"description": "When the level has been last modified.",
"format": "date-time",
"nullable": true
}
},
"additionalProperties": false
},
"CardResponseDto": {
"required": [
"createdOnUtc",
"id",
"manaCost",
"modifiedOnUtc",
"name",
"rarityId",
"themeId",
"typeId",
"version"
],
"type": "object",
"properties": {
"description": {
"maxLength": 500,
"minLength": 0,
"type": "string",
"description": "The card description.",
"nullable": true
},
"manaCost": {
"type": "integer",
"format": "int32"
},
"externalId": {
"maxLength": 24,
"minLength": 0,
"type": "string",
"description": "The external identifier",
"nullable": true
},
"themeId": {
"type": "string",
"description": "The theme identifier",
"format": "uuid"
},
"rarityId": {
"type": "string",
"description": "The rarity identifier.",
"format": "uuid"
},
"typeId": {
"type": "string",
"description": "The type identifier.",
"format": "uuid"
},
"characterTypeId": {
"type": "string",
"description": "The character type identifier.",
"format": "uuid",
"nullable": true
},
"name": {
"maxLength": 50,
"minLength": 3,
"type": "string",
"description": "The entity name",
"nullable": true
},
"id": {
"type": "string",
"description": "The entity identifier",
"format": "uuid"
},
"createdOnUtc": {
"type": "string",
"description": "The UTC time, when the entity has been created",
"format": "date-time"
},
"modifiedOnUtc": {
"type": "string",
"description": "The UTC time, when the entity has been last updated",
"format": "date-time"
},
"version": {
"type": "string",
"description": "The entity version.",
"nullable": true
}
},
"additionalProperties": false
},
"CardTypeResponseDto": {
"required": [
"createdOnUtc",
"id",
"modifiedOnUtc",
"name",
"version"
],
"type": "object",
"properties": {
"name": {
"maxLength": 50,
"minLength": 3,
"type": "string",
"description": "The entity name",
"nullable": true
},
"id": {
"type": "string",
"description": "The entity identifier",
"format": "uuid"
},
"createdOnUtc": {
"type": "string",
"description": "The UTC time, when the entity has been created",
"format": "date-time"
},
"modifiedOnUtc": {
"type": "string",
"description": "The UTC time, when the entity has been last updated",
"format": "date-time"
},
"version": {
"type": "string",
"description": "The entity version.",
"nullable": true
}
},
"additionalProperties": false,
"description": "Specifies a card type (e.g. Spell, Ranged, Fighter)"
},
"CharacterTypeResponseDto": {
"required": [
"createdOnUtc",
"id",
"modifiedOnUtc",
"name",
"version"
],
"type": "object",
"properties": {
"name": {
"maxLength": 50,
"minLength": 3,
"type": "string",
"description": "The entity name",
"nullable": true
},
"id": {
"type": "string",
"description": "The entity identifier",
"format": "uuid"
},
"createdOnUtc": {
"type": "string",
"description": "The UTC time, when the entity has been created",
"format": "date-time"
},
"modifiedOnUtc": {
"type": "string",
"description": "The UTC time, when the entity has been last updated",
"format": "date-time"
},
"version": {
"type": "string",
"description": "The entity version.",
"nullable": true
}
},
"additionalProperties": false,
"description": "Specifies a card type (e.g. Assassin, Melee, Ranged)"
},
"RarityResponseDto": {
"required": [
"createdOnUtc",
"id",
"modifiedOnUtc",
"name",
"version"
],
"type": "object",
"properties": {
"name": {
"maxLength": 50,
"minLength": 3,
"type": "string",
"description": "The entity name",
"nullable": true
},
"id": {
"type": "string",
"description": "The entity identifier",
"format": "uuid"
},
"createdOnUtc": {
"type": "string",
"description": "The UTC time, when the entity has been created",
"format": "date-time"
},
"modifiedOnUtc": {
"type": "string",
"description": "The UTC time, when the entity has been last updated",
"format": "date-time"
},
"version": {
"type": "string",
"description": "The entity version.",
"nullable": true
}
},
"additionalProperties": false,
"description": "Specifies a rarity (e.g. Common, Legendary)"
},
"ThemeResponseDto": {
"required": [
"createdOnUtc",
"id",
"modifiedOnUtc",
"name",
"version"
],
"type": "object",
"properties": {
"name": {
"maxLength": 50,
"minLength": 3,
"type": "string",
"description": "The entity name",
"nullable": true
},
"id": {
"type": "string",
"description": "The entity identifier",
"format": "uuid"
},
"createdOnUtc": {
"type": "string",
"description": "The UTC time, when the entity has been created",
"format": "date-time"
},
"modifiedOnUtc": {
"type": "string",
"description": "The UTC time, when the entity has been last updated",
"format": "date-time"
},
"version": {
"type": "string",
"description": "The entity version.",
"nullable": true
}
},
"additionalProperties": false,
"description": "Specifies a theme (e.g. Sci-Fy, Adventure)"
},
"TeamMembershipRequestDto": {
"required": [
"teamId",
"userId"
],
"type": "object",
"properties": {
"teamId": {
"type": "string",
"description": "The team identifier",
"format": "uuid"
},
"userId": {
"type": "string",
"description": "The user identifier",
"format": "uuid"
},
"comment": {
"maxLength": 500,
"minLength": 0,
"type": "string",
"description": "The comment",
"nullable": true
}
},
"additionalProperties": false
},
"TeamMembershipRequestResponseDto": {
"required": [
"id",
"teamId",
"teamName",
"userId",
"userName"
],
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "The entity identifier",
"format": "uuid"
},
"userId": {
"type": "string",
"description": "The user identifier",
"format": "uuid"
},
"userName": {
"maxLength": 50,
"minLength": 3,
"type": "string",
"description": "The name of the user",
"nullable": true
},
"comment": {
"maxLength": 500,
"minLength": 0,
"type": "string",
"description": "The comment",
"nullable": true
},
"teamId": {
"type": "string",
"format": "uuid"
},
"teamName": {
"maxLength": 50,
"minLength": 3,
"type": "string",
"nullable": true
},
"requestDateUtc": {
"type": "string",
"format": "date-time"
}
},
"additionalProperties": false
},
"TeamCreateRequestDto": {
"required": [
"name"
],
"type": "object",
"properties": {
"name": {
"maxLength": 50,
"minLength": 3,
"type": "string",
"description": "The team name",
"nullable": true
}
},
"additionalProperties": false
},
"TeamResponseDto": {
"required": [
"createdOnUtc",
"id",
"modifiedOnUtc",
"name",
"version"
],
"type": "object",
"properties": {
"federationId": {
"type": "string",
"description": "The federation identifier",
"format": "uuid",
"nullable": true
},
"avatar": {
"type": "string",
"description": "The avatar",
"format": "byte",
"nullable": true
},
"description": {
"maxLength": 2000,
"minLength": 0,
"type": "string",
"description": "The description",
"nullable": true
},
"name": {
"maxLength": 50,
"minLength": 3,
"type": "string",
"description": "The entity name",
"nullable": true
},
"id": {
"type": "string",
"description": "The entity identifier",
"format": "uuid"
},
"createdOnUtc": {
"type": "string",
"description": "The UTC time, when the entity has been created",
"format": "date-time"
},
"modifiedOnUtc": {
"type": "string",
"description": "The UTC time, when the entity has been last updated",
"format": "date-time"
},
"version": {
"type": "string",
"description": "The entity version.",
"nullable": true
}
},
"additionalProperties": false
},
"TeamUpdateRequestDto": {
"required": [
"id",
"version"
],
"type": "object",
"properties": {
"name": {
"maxLength": 50,
"minLength": 3,
"type": "string",
"description": "The name of the team",
"nullable": true
},
"description": {
"maxLength": 2000,
"minLength": 0,
"type": "string",
"description": "The description",
"nullable": true
},
"avatar": {
"type": "string",
"description": "The team avatar",
"format": "byte",
"nullable": true
},
"federationId": {
"type": "string",
"description": "The federation identifier",
"format": "uuid",
"nullable": true
},
"id": {
"type": "string",
"description": "The identifier of the entity to update",
"format": "uuid"
},
"propertiesToUpdate": {
"uniqueItems": true,
"type": "array",
"items": {
"type": "string"
},
"description": "Only the properties specified in this list will be updated. If NULL or empty, all properties will be updated.",
"nullable": true
},
"version": {
"type": "string",
"description": "The entity version",
"nullable": true
}
},
"additionalProperties": false
},
"UserProfileVisibility": {
"enum": [
0,
1,
2
],
"type": "integer",
"format": "int32"
},
"UserResponseDto": {
"required": [
"applicationRole",
"createdOnUtc",
"email",
"id",
"modifiedOnUtc",
"name",
"profileVisibility",
"sppdName",
"version"
],
"type": "object",
"properties": {
"sppdName": {
"maxLength": 50,
"minLength": 3,
"type": "string",
"description": "The South Park Phone Destroyer in-game user name",
"nullable": true
},
"email": {
"maxLength": 200,
"minLength": 0,
"type": "string",
"description": "The email address",
"nullable": true
},
"applicationRole": {
"maxLength": 20,
"minLength": 0,
"type": "string",
"description": "The application role the current user has",
"nullable": true
},
"teamId": {
"type": "string",
"description": "The team identifier",
"format": "uuid",
"nullable": true
},
"teamName": {
"type": "string",
"description": "The name of the team.",
"nullable": true
},
"teamRole": {
"type": "string",
"description": "The team role",
"nullable": true
},
"federationId": {
"type": "string",
"description": "The federation identifier",
"format": "uuid",
"nullable": true
},
"federationRole": {
"maxLength": 20,
"minLength": 0,
"type": "string",
"description": "The federation role",
"nullable": true
},
"profileVisibility": {
"$ref": "#/components/schemas/UserProfileVisibility"
},
"avatar": {
"type": "string",
"description": "The avatar",
"format": "byte",
"nullable": true
},
"description": {
"maxLength": 2000,
"minLength": 0,
"type": "string",
"description": "The description",
"nullable": true
},
"name": {
"maxLength": 50,
"minLength": 3,
"type": "string",
"description": "The entity name",
"nullable": true
},
"id": {
"type": "string",
"description": "The entity identifier",
"format": "uuid"
},
"createdOnUtc": {
"type": "string",
"description": "The UTC time, when the entity has been created",
"format": "date-time"
},
"modifiedOnUtc": {
"type": "string",
"description": "The UTC time, when the entity has been last updated",
"format": "date-time"
},
"version": {
"type": "string",
"description": "The entity version.",
"nullable": true
}
},
"additionalProperties": false
},
"UserCreateRequestDto": {
"required": [
"email",
"name",
"passwordMd5",
"sppdName"
],
"type": "object",
"properties": {
"name": {
"maxLength": 50,
"minLength": 3,
"type": "string",
"description": "The user name",
"nullable": true
},
"sppdName": {
"maxLength": 50,
"minLength": 3,
"type": "string",
"description": "The South Park Phone Destroyer in-game user name",
"nullable": true
},
"email": {
"maxLength": 200,
"minLength": 0,
"type": "string",
"description": "The email address",
"nullable": true
},
"passwordMd5": {
"maxLength": 32,
"minLength": 32,
"type": "string",
"description": "MD5 hash of the user password",
"nullable": true
}
},
"additionalProperties": false
},
"UserUpdateRequestDto": {
"required": [
"id",
"version"
],
"type": "object",
"properties": {
"name": {
"maxLength": 50,
"minLength": 3,
"type": "string",
"description": "The user name",
"nullable": true
},
"sppdName": {
"maxLength": 50,
"minLength": 3,
"type": "string",
"description": "The South Park Phone Destroyer in-game user name",
"nullable": true
},
"email": {
"maxLength": 200,
"minLength": 0,
"type": "string",
"description": "The email address",
"nullable": true
},
"avatar": {
"type": "string",
"description": "The avatar of the user",
"format": "byte",
"nullable": true
},
"description": {
"maxLength": 2000,
"minLength": 0,
"type": "string",
"description": "The description",
"nullable": true
},
"passwordMd5": {
"maxLength": 32,
"minLength": 32,
"type": "string",
"description": "MD5 hash of the user password",
"nullable": true
},
"profileVisibility": {
"$ref": "#/components/schemas/UserProfileVisibility"
},
"id": {
"type": "string",
"description": "The identifier of the entity to update",
"format": "uuid"
},
"propertiesToUpdate": {
"uniqueItems": true,
"type": "array",
"items": {
"type": "string"
},
"description": "Only the properties specified in this list will be updated. If NULL or empty, all properties will be updated.",
"nullable": true
},
"version": {
"type": "string",
"description": "The entity version",
"nullable": true
}
},
"additionalProperties": false
},
"AuthorizationRequestDto": {
"required": [
"name",
"passwordMd5"
],
"type": "object",
"properties": {
"name": {
"maxLength": 50,
"minLength": 3,
"type": "string",
"description": "User name",
"nullable": true
},
"passwordMd5": {
"maxLength": 32,
"minLength": 32,
"type": "string",
"description": "MD5 hash of the user password",
"nullable": true
}
},
"additionalProperties": false
},
"UserAuthorizationResponseDto": {
"required": [
"applicationRole",
"createdOnUtc",
"email",
"id",
"modifiedOnUtc",
"name",
"profileVisibility",
"sppdName",
"token",
"version"
],
"type": "object",
"properties": {
"token": {
"type": "string",
"description": "The token which will have to be set as bearer in the HTTP authorization header for subsequent calls requiring\r\nauthentication",
"nullable": true
},
"sppdName": {
"maxLength": 50,
"minLength": 3,
"type": "string",
"description": "The South Park Phone Destroyer in-game user name",
"nullable": true
},
"email": {
"maxLength": 200,
"minLength": 0,
"type": "string",
"description": "The email address",
"nullable": true
},
"applicationRole": {
"maxLength": 20,
"minLength": 0,
"type": "string",
"description": "The application role the current user has",
"nullable": true
},
"teamId": {
"type": "string",
"description": "The team identifier",
"format": "uuid",
"nullable": true
},
"teamName": {
"type": "string",
"description": "The name of the team.",
"nullable": true
},
"teamRole": {
"type": "string",
"description": "The team role",
"nullable": true
},
"federationId": {
"type": "string",
"description": "The federation identifier",
"format": "uuid",
"nullable": true
},
"federationRole": {
"maxLength": 20,
"minLength": 0,
"type": "string",
"description": "The federation role",
"nullable": true
},
"profileVisibility": {
"$ref": "#/components/schemas/UserProfileVisibility"
},
"avatar": {
"type": "string",
"description": "The avatar",
"format": "byte",
"nullable": true
},
"description": {
"maxLength": 2000,
"minLength": 0,
"type": "string",
"description": "The description",
"nullable": true
},
"name": {
"maxLength": 50,
"minLength": 3,
"type": "string",
"description": "The entity name",
"nullable": true
},
"id": {
"type": "string",
"description": "The entity identifier",
"format": "uuid"
},
"createdOnUtc": {
"type": "string",
"description": "The UTC time, when the entity has been created",
"format": "date-time"
},
"modifiedOnUtc": {
"type": "string",
"description": "The UTC time, when the entity has been last updated",
"format": "date-time"
},
"version": {
"type": "string",
"description": "The entity version.",
"nullable": true
}
},
"additionalProperties": false
},
"UserCardResponseDto": {
"required": [
"cardId",
"cardName",
"characterTypeId",
"rarityId",
"themeId",
"typeId",
"userId"
],
"type": "object",
"properties": {
"cardId": {
"type": "string",
"description": "The card identifier",
"format": "uuid"
},
"cardName": {
"maxLength": 50,
"minLength": 3,
"type": "string",
"description": "The name of the card",
"nullable": true
},
"userId": {
"type": "string",
"description": "The user identifier",
"format": "uuid"
},
"themeId": {
"type": "string",
"description": "The theme identifier",
"format": "uuid"
},
"rarityId": {
"type": "string",
"description": "The rarity identifier.",
"format": "uuid"
},
"typeId": {
"type": "string",
"description": "The type identifier.",
"format": "uuid"
},
"characterTypeId": {
"type": "string",
"description": "The character type identifier.",
"format": "uuid",
"nullable": true
},
"level": {
"maximum": 7,
"minimum": 1,
"type": "integer",
"description": "The level (NULL if not set)",
"format": "int32",
"nullable": true
},
"levelLastModified": {
"type": "string",
"description": "When the level has been last modified.",
"format": "date-time",
"nullable": true
}
},
"additionalProperties": false
}
},
"securitySchemes": {
"oauth2": {
"type": "apiKey",
"description": "Standard Authorization header using the Bearer scheme. Example: \"bearer {token}\"",
"name": "Authorization",
"in": "header"
}
}
}
}
Output:
/* tslint:disable */
/* eslint-disable */
//----------------------
// <auto-generated>
// Generated using the NSwag toolchain v13.0.6.0 (NJsonSchema v10.0.23.0 (Newtonsoft.Json v11.0.0.0)) (http://NSwag.org)
// </auto-generated>
//----------------------
// ReSharper disable InconsistentNaming
import axios, { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios';
export class AdministrationClient {
private instance: AxiosInstance;
private baseUrl: string;
protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined;
constructor(baseUrl?: string, instance?: AxiosInstance) {
this.instance = instance ? instance : axios.create();
this.baseUrl = baseUrl ? baseUrl : "";
}
/**
* Gets the system information containing the version, GIT commit hash and build time.
* @return Success
*/
systemInfo(): Promise<SystemInfoDto> {
let url_ = this.baseUrl + "/administration/system-info";
url_ = url_.replace(/[?&]$/, "");
let options_ = <AxiosRequestConfig>{
method: "GET",
url: url_,
headers: {
"Accept": "text/plain"
}
};
return this.instance.request(options_).then((_response: AxiosResponse) => {
return this.processSystemInfo(_response);
});
}
protected processSystemInfo(response: AxiosResponse): Promise<SystemInfoDto> {
const status = response.status;
let _headers: any = {};
if (response.headers && typeof response.headers === "object") {
for (let k in response.headers) {
if (response.headers.hasOwnProperty(k)) {
_headers[k] = response.headers[k];
}
}
}
if (status === 200) {
const _responseText = response.data;
let result200: any = null;
let resultData200 = _responseText;
result200 = SystemInfoDto.fromJS(resultData200);
return result200;
} else if (status !== 200 && status !== 204) {
const _responseText = response.data;
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}
return Promise.resolve<SystemInfoDto>(<any>null);
}
}
export class CardLevelsClient {
private instance: AxiosInstance;
private baseUrl: string;
protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined;
constructor(baseUrl?: string, instance?: AxiosInstance) {
this.instance = instance ? instance : axios.create();
this.baseUrl = baseUrl ? baseUrl : "";
}
/**
* Sets the card level for the given user and card
* @param body (optional) The card level update
* @return Success
*/
cardLevels(body: CardLevelUpdateRequestDto | undefined): Promise<CardLevelResponseDto> {
let url_ = this.baseUrl + "/card-levels";
url_ = url_.replace(/[?&]$/, "");
const content_ = JSON.stringify(body);
let options_ = <AxiosRequestConfig>{
data: content_,
method: "PUT",
url: url_,
headers: {
"Content-Type": "application/json-patch+json",
"Accept": "text/plain"
}
};
return this.instance.request(options_).then((_response: AxiosResponse) => {
return this.processCardLevels(_response);
});
}
protected processCardLevels(response: AxiosResponse): Promise<CardLevelResponseDto> {
const status = response.status;
let _headers: any = {};
if (response.headers && typeof response.headers === "object") {
for (let k in response.headers) {
if (response.headers.hasOwnProperty(k)) {
_headers[k] = response.headers[k];
}
}
}
if (status === 200) {
const _responseText = response.data;
let result200: any = null;
let resultData200 = _responseText;
result200 = CardLevelResponseDto.fromJS(resultData200);
return result200;
} else if (status === 401) {
const _responseText = response.data;
return throwException("Unauthorized", status, _responseText, _headers);
} else if (status === 403) {
const _responseText = response.data;
return throwException("Forbidden", status, _responseText, _headers);
} else if (status !== 200 && status !== 204) {
const _responseText = response.data;
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}
return Promise.resolve<CardLevelResponseDto>(<any>null);
}
}
export class CardsClient {
private instance: AxiosInstance;
private baseUrl: string;
protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined;
constructor(baseUrl?: string, instance?: AxiosInstance) {
this.instance = instance ? instance : axios.create();
this.baseUrl = baseUrl ? baseUrl : "";
}
/**
* Gets all the cards
* @return Success
*/
cardsAll(): Promise<CardResponseDto[]> {
let url_ = this.baseUrl + "/cards";
url_ = url_.replace(/[?&]$/, "");
let options_ = <AxiosRequestConfig>{
method: "GET",
url: url_,
headers: {
"Accept": "text/plain"
}
};
return this.instance.request(options_).then((_response: AxiosResponse) => {
return this.processCardsAll(_response);
});
}
protected processCardsAll(response: AxiosResponse): Promise<CardResponseDto[]> {
const status = response.status;
let _headers: any = {};
if (response.headers && typeof response.headers === "object") {
for (let k in response.headers) {
if (response.headers.hasOwnProperty(k)) {
_headers[k] = response.headers[k];
}
}
}
if (status === 200) {
const _responseText = response.data;
let result200: any = null;
let resultData200 = _responseText;
if (Array.isArray(resultData200)) {
result200 = [] as any;
for (let item of resultData200)
result200!.push(CardResponseDto.fromJS(item));
}
return result200;
} else if (status !== 200 && status !== 204) {
const _responseText = response.data;
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}
return Promise.resolve<CardResponseDto[]>(<any>null);
}
}
export class CoreDataClient {
private instance: AxiosInstance;
private baseUrl: string;
protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined;
constructor(baseUrl?: string, instance?: AxiosInstance) {
this.instance = instance ? instance : axios.create();
this.baseUrl = baseUrl ? baseUrl : "";
}
/**
* Gets all card types (Spell, Spawn, Character)
* @return Success
*/
cardTypes(): Promise<CardTypeResponseDto[]> {
let url_ = this.baseUrl + "/core-data/card-types";
url_ = url_.replace(/[?&]$/, "");
let options_ = <AxiosRequestConfig>{
method: "GET",
url: url_,
headers: {
"Accept": "text/plain"
}
};
return this.instance.request(options_).then((_response: AxiosResponse) => {
return this.processCardTypes(_response);
});
}
protected processCardTypes(response: AxiosResponse): Promise<CardTypeResponseDto[]> {
const status = response.status;
let _headers: any = {};
if (response.headers && typeof response.headers === "object") {
for (let k in response.headers) {
if (response.headers.hasOwnProperty(k)) {
_headers[k] = response.headers[k];
}
}
}
if (status === 200) {
const _responseText = response.data;
let result200: any = null;
let resultData200 = _responseText;
if (Array.isArray(resultData200)) {
result200 = [] as any;
for (let item of resultData200)
result200!.push(CardTypeResponseDto.fromJS(item));
}
return result200;
} else if (status !== 200 && status !== 204) {
const _responseText = response.data;
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}
return Promise.resolve<CardTypeResponseDto[]>(<any>null);
}
/**
* Gets all character types (Assassin, Melee...)
* @return Success
*/
characterTypes(): Promise<CharacterTypeResponseDto[]> {
let url_ = this.baseUrl + "/core-data/character-types";
url_ = url_.replace(/[?&]$/, "");
let options_ = <AxiosRequestConfig>{
method: "GET",
url: url_,
headers: {
"Accept": "text/plain"
}
};
return this.instance.request(options_).then((_response: AxiosResponse) => {
return this.processCharacterTypes(_response);
});
}
protected processCharacterTypes(response: AxiosResponse): Promise<CharacterTypeResponseDto[]> {
const status = response.status;
let _headers: any = {};
if (response.headers && typeof response.headers === "object") {
for (let k in response.headers) {
if (response.headers.hasOwnProperty(k)) {
_headers[k] = response.headers[k];
}
}
}
if (status === 200) {
const _responseText = response.data;
let result200: any = null;
let resultData200 = _responseText;
if (Array.isArray(resultData200)) {
result200 = [] as any;
for (let item of resultData200)
result200!.push(CharacterTypeResponseDto.fromJS(item));
}
return result200;
} else if (status !== 200 && status !== 204) {
const _responseText = response.data;
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}
return Promise.resolve<CharacterTypeResponseDto[]>(<any>null);
}
/**
* Gets all rarities (Common, Rare...)
* @return Success
*/
rarities(): Promise<RarityResponseDto[]> {
let url_ = this.baseUrl + "/core-data/rarities";
url_ = url_.replace(/[?&]$/, "");
let options_ = <AxiosRequestConfig>{
method: "GET",
url: url_,
headers: {
"Accept": "text/plain"
}
};
return this.instance.request(options_).then((_response: AxiosResponse) => {
return this.processRarities(_response);
});
}
protected processRarities(response: AxiosResponse): Promise<RarityResponseDto[]> {
const status = response.status;
let _headers: any = {};
if (response.headers && typeof response.headers === "object") {
for (let k in response.headers) {
if (response.headers.hasOwnProperty(k)) {
_headers[k] = response.headers[k];
}
}
}
if (status === 200) {
const _responseText = response.data;
let result200: any = null;
let resultData200 = _responseText;
if (Array.isArray(resultData200)) {
result200 = [] as any;
for (let item of resultData200)
result200!.push(RarityResponseDto.fromJS(item));
}
return result200;
} else if (status !== 200 && status !== 204) {
const _responseText = response.data;
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}
return Promise.resolve<RarityResponseDto[]>(<any>null);
}
/**
* Gets all themes (Sci-fy, Fantasy...)
* @return Success
*/
themes(): Promise<ThemeResponseDto[]> {
let url_ = this.baseUrl + "/core-data/themes";
url_ = url_.replace(/[?&]$/, "");
let options_ = <AxiosRequestConfig>{
method: "GET",
url: url_,
headers: {
"Accept": "text/plain"
}
};
return this.instance.request(options_).then((_response: AxiosResponse) => {
return this.processThemes(_response);
});
}
protected processThemes(response: AxiosResponse): Promise<ThemeResponseDto[]> {
const status = response.status;
let _headers: any = {};
if (response.headers && typeof response.headers === "object") {
for (let k in response.headers) {
if (response.headers.hasOwnProperty(k)) {
_headers[k] = response.headers[k];
}
}
}
if (status === 200) {
const _responseText = response.data;
let result200: any = null;
let resultData200 = _responseText;
if (Array.isArray(resultData200)) {
result200 = [] as any;
for (let item of resultData200)
result200!.push(ThemeResponseDto.fromJS(item));
}
return result200;
} else if (status !== 200 && status !== 204) {
const _responseText = response.data;
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}
return Promise.resolve<ThemeResponseDto[]>(<any>null);
}
}
export class EmailVerificationClient {
private instance: AxiosInstance;
private baseUrl: string;
protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined;
constructor(baseUrl?: string, instance?: AxiosInstance) {
this.instance = instance ? instance : axios.create();
this.baseUrl = baseUrl ? baseUrl : "";
}
/**
* Verifies the email with the given code.
* @param code The code.
* @return Success
*/
verify(code: string): Promise<boolean> {
let url_ = this.baseUrl + "/email-verification/{code}/verify";
if (code === undefined || code === null)
throw new Error("The parameter 'code' must be defined.");
url_ = url_.replace("{code}", encodeURIComponent("" + code));
url_ = url_.replace(/[?&]$/, "");
let options_ = <AxiosRequestConfig>{
method: "GET",
url: url_,
headers: {
"Accept": "text/plain"
}
};
return this.instance.request(options_).then((_response: AxiosResponse) => {
return this.processVerify(_response);
});
}
protected processVerify(response: AxiosResponse): Promise<boolean> {
const status = response.status;
let _headers: any = {};
if (response.headers && typeof response.headers === "object") {
for (let k in response.headers) {
if (response.headers.hasOwnProperty(k)) {
_headers[k] = response.headers[k];
}
}
}
if (status === 200) {
const _responseText = response.data;
let result200: any = null;
let resultData200 = _responseText;
result200 = resultData200 !== undefined ? resultData200 : <any>null;
return result200;
} else if (status !== 200 && status !== 204) {
const _responseText = response.data;
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}
return Promise.resolve<boolean>(<any>null);
}
/**
* Sends a previously sent verification email.
* @param code The code.
* @return Success
*/
resend(code: string): Promise<void> {
let url_ = this.baseUrl + "/email-verification/{code}/resend";
if (code === undefined || code === null)
throw new Error("The parameter 'code' must be defined.");
url_ = url_.replace("{code}", encodeURIComponent("" + code));
url_ = url_.replace(/[?&]$/, "");
let options_ = <AxiosRequestConfig>{
method: "GET",
url: url_,
headers: {
}
};
return this.instance.request(options_).then((_response: AxiosResponse) => {
return this.processResend(_response);
});
}
protected processResend(response: AxiosResponse): Promise<void> {
const status = response.status;
let _headers: any = {};
if (response.headers && typeof response.headers === "object") {
for (let k in response.headers) {
if (response.headers.hasOwnProperty(k)) {
_headers[k] = response.headers[k];
}
}
}
if (status === 200) {
const _responseText = response.data;
return Promise.resolve<void>(<any>null);
} else if (status !== 200 && status !== 204) {
const _responseText = response.data;
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}
return Promise.resolve<void>(<any>null);
}
}
export class TeamMembershipRequestsClient {
private instance: AxiosInstance;
private baseUrl: string;
protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined;
constructor(baseUrl?: string, instance?: AxiosInstance) {
this.instance = instance ? instance : axios.create();
this.baseUrl = baseUrl ? baseUrl : "";
}
/**
* Requests membership in a team for a user
* @param body (optional) The membership request for a user to join a team
* @return Success
*/
teamMembershipRequests(body: TeamMembershipRequestDto | undefined): Promise<void> {
let url_ = this.baseUrl + "/team-membership-requests";
url_ = url_.replace(/[?&]$/, "");
const content_ = JSON.stringify(body);
let options_ = <AxiosRequestConfig>{
data: content_,
method: "POST",
url: url_,
headers: {
"Content-Type": "application/json-patch+json",
}
};
return this.instance.request(options_).then((_response: AxiosResponse) => {
return this.processTeamMembershipRequests(_response);
});
}
protected processTeamMembershipRequests(response: AxiosResponse): Promise<void> {
const status = response.status;
let _headers: any = {};
if (response.headers && typeof response.headers === "object") {
for (let k in response.headers) {
if (response.headers.hasOwnProperty(k)) {
_headers[k] = response.headers[k];
}
}
}
if (status === 200) {
const _responseText = response.data;
return Promise.resolve<void>(<any>null);
} else if (status === 401) {
const _responseText = response.data;
return throwException("Unauthorized", status, _responseText, _headers);
} else if (status === 403) {
const _responseText = response.data;
return throwException("Forbidden", status, _responseText, _headers);
} else if (status !== 200 && status !== 204) {
const _responseText = response.data;
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}
return Promise.resolve<void>(<any>null);
}
/**
* Gets the pending team membership request for the user.
* @param userId (optional) The user identifier.
* @return Success
*/
teamMembershipRequests2(userId: string | undefined): Promise<TeamMembershipRequestResponseDto> {
let url_ = this.baseUrl + "/team-membership-requests?";
if (userId === null)
throw new Error("The parameter 'userId' cannot be null.");
else if (userId !== undefined)
url_ += "userId=" + encodeURIComponent("" + userId) + "&";
url_ = url_.replace(/[?&]$/, "");
let options_ = <AxiosRequestConfig>{
method: "GET",
url: url_,
headers: {
"Accept": "text/plain"
}
};
return this.instance.request(options_).then((_response: AxiosResponse) => {
return this.processTeamMembershipRequests2(_response);
});
}
protected processTeamMembershipRequests2(response: AxiosResponse): Promise<TeamMembershipRequestResponseDto> {
const status = response.status;
let _headers: any = {};
if (response.headers && typeof response.headers === "object") {
for (let k in response.headers) {
if (response.headers.hasOwnProperty(k)) {
_headers[k] = response.headers[k];
}
}
}
if (status === 200) {
const _responseText = response.data;
let result200: any = null;
let resultData200 = _responseText;
result200 = TeamMembershipRequestResponseDto.fromJS(resultData200);
return result200;
} else if (status === 401) {
const _responseText = response.data;
return throwException("Unauthorized", status, _responseText, _headers);
} else if (status === 403) {
const _responseText = response.data;
return throwException("Forbidden", status, _responseText, _headers);
} else if (status !== 200 && status !== 204) {
const _responseText = response.data;
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}
return Promise.resolve<TeamMembershipRequestResponseDto>(<any>null);
}
/**
* Accepts the membership request
* @param id The membership request identifier
* @return Success
*/
accept(id: string): Promise<void> {
let url_ = this.baseUrl + "/team-membership-requests/{id}/accept";
if (id === undefined || id === null)
throw new Error("The parameter 'id' must be defined.");
url_ = url_.replace("{id}", encodeURIComponent("" + id));
url_ = url_.replace(/[?&]$/, "");
let options_ = <AxiosRequestConfig>{
method: "POST",
url: url_,
headers: {
}
};
return this.instance.request(options_).then((_response: AxiosResponse) => {
return this.processAccept(_response);
});
}
protected processAccept(response: AxiosResponse): Promise<void> {
const status = response.status;
let _headers: any = {};
if (response.headers && typeof response.headers === "object") {
for (let k in response.headers) {
if (response.headers.hasOwnProperty(k)) {
_headers[k] = response.headers[k];
}
}
}
if (status === 200) {
const _responseText = response.data;
return Promise.resolve<void>(<any>null);
} else if (status === 401) {
const _responseText = response.data;
return throwException("Unauthorized", status, _responseText, _headers);
} else if (status === 403) {
const _responseText = response.data;
return throwException("Forbidden", status, _responseText, _headers);
} else if (status !== 200 && status !== 204) {
const _responseText = response.data;
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}
return Promise.resolve<void>(<any>null);
}
/**
* Rejects the membership request
* @param id The membership request identifier
* @return Success
*/
reject(id: string): Promise<void> {
let url_ = this.baseUrl + "/team-membership-requests/{id}/reject";
if (id === undefined || id === null)
throw new Error("The parameter 'id' must be defined.");
url_ = url_.replace("{id}", encodeURIComponent("" + id));
url_ = url_.replace(/[?&]$/, "");
let options_ = <AxiosRequestConfig>{
method: "POST",
url: url_,
headers: {
}
};
return this.instance.request(options_).then((_response: AxiosResponse) => {
return this.processReject(_response);
});
}
protected processReject(response: AxiosResponse): Promise<void> {
const status = response.status;
let _headers: any = {};
if (response.headers && typeof response.headers === "object") {
for (let k in response.headers) {
if (response.headers.hasOwnProperty(k)) {
_headers[k] = response.headers[k];
}
}
}
if (status === 200) {
const _responseText = response.data;
return Promise.resolve<void>(<any>null);
} else if (status === 401) {
const _responseText = response.data;
return throwException("Unauthorized", status, _responseText, _headers);
} else if (status === 403) {
const _responseText = response.data;
return throwException("Forbidden", status, _responseText, _headers);
} else if (status !== 200 && status !== 204) {
const _responseText = response.data;
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}
return Promise.resolve<void>(<any>null);
}
/**
* Aborts the membership request
* @param id The membership request identifier
* @return Success
*/
abort(id: string): Promise<void> {
let url_ = this.baseUrl + "/team-membership-requests/{id}/abort";
if (id === undefined || id === null)
throw new Error("The parameter 'id' must be defined.");
url_ = url_.replace("{id}", encodeURIComponent("" + id));
url_ = url_.replace(/[?&]$/, "");
let options_ = <AxiosRequestConfig>{
method: "POST",
url: url_,
headers: {
}
};
return this.instance.request(options_).then((_response: AxiosResponse) => {
return this.processAbort(_response);
});
}
protected processAbort(response: AxiosResponse): Promise<void> {
const status = response.status;
let _headers: any = {};
if (response.headers && typeof response.headers === "object") {
for (let k in response.headers) {
if (response.headers.hasOwnProperty(k)) {
_headers[k] = response.headers[k];
}
}
}
if (status === 200) {
const _responseText = response.data;
return Promise.resolve<void>(<any>null);
} else if (status === 401) {
const _responseText = response.data;
return throwException("Unauthorized", status, _responseText, _headers);
} else if (status === 403) {
const _responseText = response.data;
return throwException("Forbidden", status, _responseText, _headers);
} else if (status !== 200 && status !== 204) {
const _responseText = response.data;
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}
return Promise.resolve<void>(<any>null);
}
}
export class TeamsClient {
private instance: AxiosInstance;
private baseUrl: string;
protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined;
constructor(baseUrl?: string, instance?: AxiosInstance) {
this.instance = instance ? instance : axios.create();
this.baseUrl = baseUrl ? baseUrl : "";
}
/**
* Creates a new team
* @param body (optional) The team creation request
* @return Success
*/
teams(body: TeamCreateRequestDto | undefined): Promise<TeamResponseDto> {
let url_ = this.baseUrl + "/teams";
url_ = url_.replace(/[?&]$/, "");
const content_ = JSON.stringify(body);
let options_ = <AxiosRequestConfig>{
data: content_,
method: "POST",
url: url_,
headers: {
"Content-Type": "application/json-patch+json",
"Accept": "text/plain"
}
};
return this.instance.request(options_).then((_response: AxiosResponse) => {
return this.processTeams(_response);
});
}
protected processTeams(response: AxiosResponse): Promise<TeamResponseDto> {
const status = response.status;
let _headers: any = {};
if (response.headers && typeof response.headers === "object") {
for (let k in response.headers) {
if (response.headers.hasOwnProperty(k)) {
_headers[k] = response.headers[k];
}
}
}
if (status === 200) {
const _responseText = response.data;
let result200: any = null;
let resultData200 = _responseText;
result200 = TeamResponseDto.fromJS(resultData200);
return result200;
} else if (status === 401) {
const _responseText = response.data;
return throwException("Unauthorized", status, _responseText, _headers);
} else if (status === 403) {
const _responseText = response.data;
return throwException("Forbidden", status, _responseText, _headers);
} else if (status !== 200 && status !== 204) {
const _responseText = response.data;
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}
return Promise.resolve<TeamResponseDto>(<any>null);
}
/**
* Updates the team
* @param body (optional) The team update request
* @return Success
*/
teams2(body: TeamUpdateRequestDto | undefined): Promise<TeamResponseDto> {
let url_ = this.baseUrl + "/teams";
url_ = url_.replace(/[?&]$/, "");
const content_ = JSON.stringify(body);
let options_ = <AxiosRequestConfig>{
data: content_,
method: "PUT",
url: url_,
headers: {
"Content-Type": "application/json-patch+json",
"Accept": "text/plain"
}
};
return this.instance.request(options_).then((_response: AxiosResponse) => {
return this.processTeams2(_response);
});
}
protected processTeams2(response: AxiosResponse): Promise<TeamResponseDto> {
const status = response.status;
let _headers: any = {};
if (response.headers && typeof response.headers === "object") {
for (let k in response.headers) {
if (response.headers.hasOwnProperty(k)) {
_headers[k] = response.headers[k];
}
}
}
if (status === 200) {
const _responseText = response.data;
let result200: any = null;
let resultData200 = _responseText;
result200 = TeamResponseDto.fromJS(resultData200);
return result200;
} else if (status === 401) {
const _responseText = response.data;
return throwException("Unauthorized", status, _responseText, _headers);
} else if (status === 403) {
const _responseText = response.data;
return throwException("Forbidden", status, _responseText, _headers);
} else if (status !== 200 && status !== 204) {
const _responseText = response.data;
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}
return Promise.resolve<TeamResponseDto>(<any>null);
}
/**
* Get all teams containing the specified name in their name.
* @param name (optional) The name having to be contained in the team name.
* @return Success
*/
teamsAll(name: string | undefined): Promise<TeamResponseDto[]> {
let url_ = this.baseUrl + "/teams?";
if (name === null)
throw new Error("The parameter 'name' cannot be null.");
else if (name !== undefined)
url_ += "name=" + encodeURIComponent("" + name) + "&";
url_ = url_.replace(/[?&]$/, "");
let options_ = <AxiosRequestConfig>{
method: "GET",
url: url_,
headers: {
"Accept": "text/plain"
}
};
return this.instance.request(options_).then((_response: AxiosResponse) => {
return this.processTeamsAll(_response);
});
}
protected processTeamsAll(response: AxiosResponse): Promise<TeamResponseDto[]> {
const status = response.status;
let _headers: any = {};
if (response.headers && typeof response.headers === "object") {
for (let k in response.headers) {
if (response.headers.hasOwnProperty(k)) {
_headers[k] = response.headers[k];
}
}
}
if (status === 200) {
const _responseText = response.data;
let result200: any = null;
let resultData200 = _responseText;
if (Array.isArray(resultData200)) {
result200 = [] as any;
for (let item of resultData200)
result200!.push(TeamResponseDto.fromJS(item));
}
return result200;
} else if (status !== 200 && status !== 204) {
const _responseText = response.data;
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}
return Promise.resolve<TeamResponseDto[]>(<any>null);
}
/**
* Deletes the team
* @param id The team identifier
* @return Success
*/
teams3(id: string): Promise<void> {
let url_ = this.baseUrl + "/teams/{id}";
if (id === undefined || id === null)
throw new Error("The parameter 'id' must be defined.");
url_ = url_.replace("{id}", encodeURIComponent("" + id));
url_ = url_.replace(/[?&]$/, "");
let options_ = <AxiosRequestConfig>{
method: "DELETE",
url: url_,
headers: {
}
};
return this.instance.request(options_).then((_response: AxiosResponse) => {
return this.processTeams3(_response);
});
}
protected processTeams3(response: AxiosResponse): Promise<void> {
const status = response.status;
let _headers: any = {};
if (response.headers && typeof response.headers === "object") {
for (let k in response.headers) {
if (response.headers.hasOwnProperty(k)) {
_headers[k] = response.headers[k];
}
}
}
if (status === 200) {
const _responseText = response.data;
return Promise.resolve<void>(<any>null);
} else if (status === 401) {
const _responseText = response.data;
return throwException("Unauthorized", status, _responseText, _headers);
} else if (status === 403) {
const _responseText = response.data;
return throwException("Forbidden", status, _responseText, _headers);
} else if (status !== 200 && status !== 204) {
const _responseText = response.data;
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}
return Promise.resolve<void>(<any>null);
}
/**
* Gets the team
* @param id The team identifier
* @return Success
*/
teams4(id: string): Promise<TeamResponseDto> {
let url_ = this.baseUrl + "/teams/{id}";
if (id === undefined || id === null)
throw new Error("The parameter 'id' must be defined.");
url_ = url_.replace("{id}", encodeURIComponent("" + id));
url_ = url_.replace(/[?&]$/, "");
let options_ = <AxiosRequestConfig>{
method: "GET",
url: url_,
headers: {
"Accept": "text/plain"
}
};
return this.instance.request(options_).then((_response: AxiosResponse) => {
return this.processTeams4(_response);
});
}
protected processTeams4(response: AxiosResponse): Promise<TeamResponseDto> {
const status = response.status;
let _headers: any = {};
if (response.headers && typeof response.headers === "object") {
for (let k in response.headers) {
if (response.headers.hasOwnProperty(k)) {
_headers[k] = response.headers[k];
}
}
}
if (status === 200) {
const _responseText = response.data;
let result200: any = null;
let resultData200 = _responseText;
result200 = TeamResponseDto.fromJS(resultData200);
return result200;
} else if (status === 401) {
const _responseText = response.data;
return throwException("Unauthorized", status, _responseText, _headers);
} else if (status === 403) {
const _responseText = response.data;
return throwException("Forbidden", status, _responseText, _headers);
} else if (status !== 200 && status !== 204) {
const _responseText = response.data;
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}
return Promise.resolve<TeamResponseDto>(<any>null);
}
/**
* Gets the team members.
* @param id The team identifier
* @return Success
*/
members(id: string): Promise<UserResponseDto[]> {
let url_ = this.baseUrl + "/teams/{id}/members";
if (id === undefined || id === null)
throw new Error("The parameter 'id' must be defined.");
url_ = url_.replace("{id}", encodeURIComponent("" + id));
url_ = url_.replace(/[?&]$/, "");
let options_ = <AxiosRequestConfig>{
method: "GET",
url: url_,
headers: {
"Accept": "text/plain"
}
};
return this.instance.request(options_).then((_response: AxiosResponse) => {
return this.processMembers(_response);
});
}
protected processMembers(response: AxiosResponse): Promise<UserResponseDto[]> {
const status = response.status;
let _headers: any = {};
if (response.headers && typeof response.headers === "object") {
for (let k in response.headers) {
if (response.headers.hasOwnProperty(k)) {
_headers[k] = response.headers[k];
}
}
}
if (status === 200) {
const _responseText = response.data;
let result200: any = null;
let resultData200 = _responseText;
if (Array.isArray(resultData200)) {
result200 = [] as any;
for (let item of resultData200)
result200!.push(UserResponseDto.fromJS(item));
}
return result200;
} else if (status === 401) {
const _responseText = response.data;
return throwException("Unauthorized", status, _responseText, _headers);
} else if (status === 403) {
const _responseText = response.data;
return throwException("Forbidden", status, _responseText, _headers);
} else if (status !== 200 && status !== 204) {
const _responseText = response.data;
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}
return Promise.resolve<UserResponseDto[]>(<any>null);
}
/**
* Gets the membership requests.
* @param id The team identifier
* @return Success
*/
membershipRequests(id: string): Promise<TeamMembershipRequestResponseDto[]> {
let url_ = this.baseUrl + "/teams/{id}/membership-requests";
if (id === undefined || id === null)
throw new Error("The parameter 'id' must be defined.");
url_ = url_.replace("{id}", encodeURIComponent("" + id));
url_ = url_.replace(/[?&]$/, "");
let options_ = <AxiosRequestConfig>{
method: "GET",
url: url_,
headers: {
"Accept": "text/plain"
}
};
return this.instance.request(options_).then((_response: AxiosResponse) => {
return this.processMembershipRequests(_response);
});
}
protected processMembershipRequests(response: AxiosResponse): Promise<TeamMembershipRequestResponseDto[]> {
const status = response.status;
let _headers: any = {};
if (response.headers && typeof response.headers === "object") {
for (let k in response.headers) {
if (response.headers.hasOwnProperty(k)) {
_headers[k] = response.headers[k];
}
}
}
if (status === 200) {
const _responseText = response.data;
let result200: any = null;
let resultData200 = _responseText;
if (Array.isArray(resultData200)) {
result200 = [] as any;
for (let item of resultData200)
result200!.push(TeamMembershipRequestResponseDto.fromJS(item));
}
return result200;
} else if (status === 401) {
const _responseText = response.data;
return throwException("Unauthorized", status, _responseText, _headers);
} else if (status === 403) {
const _responseText = response.data;
return throwException("Forbidden", status, _responseText, _headers);
} else if (status !== 200 && status !== 204) {
const _responseText = response.data;
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}
return Promise.resolve<TeamMembershipRequestResponseDto[]>(<any>null);
}
}
export class UsersClient {
private instance: AxiosInstance;
private baseUrl: string;
protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined;
constructor(baseUrl?: string, instance?: AxiosInstance) {
this.instance = instance ? instance : axios.create();
this.baseUrl = baseUrl ? baseUrl : "";
}
/**
* Creates a new user
* @param body (optional) The user creation request
* @return Success
*/
users(body: UserCreateRequestDto | undefined): Promise<UserResponseDto> {
let url_ = this.baseUrl + "/users";
url_ = url_.replace(/[?&]$/, "");
const content_ = JSON.stringify(body);
let options_ = <AxiosRequestConfig>{
data: content_,
method: "POST",
url: url_,
headers: {
"Content-Type": "application/json-patch+json",
"Accept": "text/plain"
}
};
return this.instance.request(options_).then((_response: AxiosResponse) => {
return this.processUsers(_response);
});
}
protected processUsers(response: AxiosResponse): Promise<UserResponseDto> {
const status = response.status;
let _headers: any = {};
if (response.headers && typeof response.headers === "object") {
for (let k in response.headers) {
if (response.headers.hasOwnProperty(k)) {
_headers[k] = response.headers[k];
}
}
}
if (status === 200) {
const _responseText = response.data;
let result200: any = null;
let resultData200 = _responseText;
result200 = UserResponseDto.fromJS(resultData200);
return result200;
} else if (status !== 200 && status !== 204) {
const _responseText = response.data;
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}
return Promise.resolve<UserResponseDto>(<any>null);
}
/**
* Updates the user
* @param body (optional) The user update request
* @return Success
*/
users2(body: UserUpdateRequestDto | undefined): Promise<UserResponseDto> {
let url_ = this.baseUrl + "/users";
url_ = url_.replace(/[?&]$/, "");
const content_ = JSON.stringify(body);
let options_ = <AxiosRequestConfig>{
data: content_,
method: "PUT",
url: url_,
headers: {
"Content-Type": "application/json-patch+json",
"Accept": "text/plain"
}
};
return this.instance.request(options_).then((_response: AxiosResponse) => {
return this.processUsers2(_response);
});
}
protected processUsers2(response: AxiosResponse): Promise<UserResponseDto> {
const status = response.status;
let _headers: any = {};
if (response.headers && typeof response.headers === "object") {
for (let k in response.headers) {
if (response.headers.hasOwnProperty(k)) {
_headers[k] = response.headers[k];
}
}
}
if (status === 200) {
const _responseText = response.data;
let result200: any = null;
let resultData200 = _responseText;
result200 = UserResponseDto.fromJS(resultData200);
return result200;
} else if (status === 401) {
const _responseText = response.data;
return throwException("Unauthorized", status, _responseText, _headers);
} else if (status === 403) {
const _responseText = response.data;
return throwException("Forbidden", status, _responseText, _headers);
} else if (status !== 200 && status !== 204) {
const _responseText = response.data;
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}
return Promise.resolve<UserResponseDto>(<any>null);
}
/**
* Leave the team the user is currently in.
* @param id The user identifier.
* @return Success
*/
leaveTeam(id: string): Promise<UserResponseDto> {
let url_ = this.baseUrl + "/users/{id}/leaveTeam";
if (id === undefined || id === null)
throw new Error("The parameter 'id' must be defined.");
url_ = url_.replace("{id}", encodeURIComponent("" + id));
url_ = url_.replace(/[?&]$/, "");
let options_ = <AxiosRequestConfig>{
method: "PUT",
url: url_,
headers: {
"Accept": "text/plain"
}
};
return this.instance.request(options_).then((_response: AxiosResponse) => {
return this.processLeaveTeam(_response);
});
}
protected processLeaveTeam(response: AxiosResponse): Promise<UserResponseDto> {
const status = response.status;
let _headers: any = {};
if (response.headers && typeof response.headers === "object") {
for (let k in response.headers) {
if (response.headers.hasOwnProperty(k)) {
_headers[k] = response.headers[k];
}
}
}
if (status === 200) {
const _responseText = response.data;
let result200: any = null;
let resultData200 = _responseText;
result200 = UserResponseDto.fromJS(resultData200);
return result200;
} else if (status === 401) {
const _responseText = response.data;
return throwException("Unauthorized", status, _responseText, _headers);
} else if (status === 403) {
const _responseText = response.data;
return throwException("Forbidden", status, _responseText, _headers);
} else if (status !== 200 && status !== 204) {
const _responseText = response.data;
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}
return Promise.resolve<UserResponseDto>(<any>null);
}
/**
* Authorizes the user
* @param body (optional) The authorization request
* @return Success
*/
authorize(body: AuthorizationRequestDto | undefined): Promise<UserAuthorizationResponseDto> {
let url_ = this.baseUrl + "/users/authorize";
url_ = url_.replace(/[?&]$/, "");
const content_ = JSON.stringify(body);
let options_ = <AxiosRequestConfig>{
data: content_,
method: "POST",
url: url_,
headers: {
"Content-Type": "application/json-patch+json",
"Accept": "text/plain"
}
};
return this.instance.request(options_).then((_response: AxiosResponse) => {
return this.processAuthorize(_response);
});
}
protected processAuthorize(response: AxiosResponse): Promise<UserAuthorizationResponseDto> {
const status = response.status;
let _headers: any = {};
if (response.headers && typeof response.headers === "object") {
for (let k in response.headers) {
if (response.headers.hasOwnProperty(k)) {
_headers[k] = response.headers[k];
}
}
}
if (status === 200) {
const _responseText = response.data;
let result200: any = null;
let resultData200 = _responseText;
result200 = UserAuthorizationResponseDto.fromJS(resultData200);
return result200;
} else if (status !== 200 && status !== 204) {
const _responseText = response.data;
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}
return Promise.resolve<UserAuthorizationResponseDto>(<any>null);
}
/**
* Deletes the user
* @param id The user identifier
* @return Success
*/
users3(id: string): Promise<void> {
let url_ = this.baseUrl + "/users/{id}";
if (id === undefined || id === null)
throw new Error("The parameter 'id' must be defined.");
url_ = url_.replace("{id}", encodeURIComponent("" + id));
url_ = url_.replace(/[?&]$/, "");
let options_ = <AxiosRequestConfig>{
method: "DELETE",
url: url_,
headers: {
}
};
return this.instance.request(options_).then((_response: AxiosResponse) => {
return this.processUsers3(_response);
});
}
protected processUsers3(response: AxiosResponse): Promise<void> {
const status = response.status;
let _headers: any = {};
if (response.headers && typeof response.headers === "object") {
for (let k in response.headers) {
if (response.headers.hasOwnProperty(k)) {
_headers[k] = response.headers[k];
}
}
}
if (status === 200) {
const _responseText = response.data;
return Promise.resolve<void>(<any>null);
} else if (status === 401) {
const _responseText = response.data;
return throwException("Unauthorized", status, _responseText, _headers);
} else if (status === 403) {
const _responseText = response.data;
return throwException("Forbidden", status, _responseText, _headers);
} else if (status !== 200 && status !== 204) {
const _responseText = response.data;
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}
return Promise.resolve<void>(<any>null);
}
/**
* Gets the user
* @param id The user identifier
* @return Success
*/
users4(id: string): Promise<UserResponseDto> {
let url_ = this.baseUrl + "/users/{id}";
if (id === undefined || id === null)
throw new Error("The parameter 'id' must be defined.");
url_ = url_.replace("{id}", encodeURIComponent("" + id));
url_ = url_.replace(/[?&]$/, "");
let options_ = <AxiosRequestConfig>{
method: "GET",
url: url_,
headers: {
"Accept": "text/plain"
}
};
return this.instance.request(options_).then((_response: AxiosResponse) => {
return this.processUsers4(_response);
});
}
protected processUsers4(response: AxiosResponse): Promise<UserResponseDto> {
const status = response.status;
let _headers: any = {};
if (response.headers && typeof response.headers === "object") {
for (let k in response.headers) {
if (response.headers.hasOwnProperty(k)) {
_headers[k] = response.headers[k];
}
}
}
if (status === 200) {
const _responseText = response.data;
let result200: any = null;
let resultData200 = _responseText;
result200 = UserResponseDto.fromJS(resultData200);
return result200;
} else if (status === 401) {
const _responseText = response.data;
return throwException("Unauthorized", status, _responseText, _headers);
} else if (status === 403) {
const _responseText = response.data;
return throwException("Forbidden", status, _responseText, _headers);
} else if (status !== 200 && status !== 204) {
const _responseText = response.data;
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}
return Promise.resolve<UserResponseDto>(<any>null);
}
/**
* Gets all card levels having been set for the user
* @param id The user identifier
* @return Success
*/
cardLevelsAll(id: string): Promise<CardLevelResponseDto[]> {
let url_ = this.baseUrl + "/users/{id}/card-levels";
if (id === undefined || id === null)
throw new Error("The parameter 'id' must be defined.");
url_ = url_.replace("{id}", encodeURIComponent("" + id));
url_ = url_.replace(/[?&]$/, "");
let options_ = <AxiosRequestConfig>{
method: "GET",
url: url_,
headers: {
"Accept": "text/plain"
}
};
return this.instance.request(options_).then((_response: AxiosResponse) => {
return this.processCardLevelsAll(_response);
});
}
protected processCardLevelsAll(response: AxiosResponse): Promise<CardLevelResponseDto[]> {
const status = response.status;
let _headers: any = {};
if (response.headers && typeof response.headers === "object") {
for (let k in response.headers) {
if (response.headers.hasOwnProperty(k)) {
_headers[k] = response.headers[k];
}
}
}
if (status === 200) {
const _responseText = response.data;
let result200: any = null;
let resultData200 = _responseText;
if (Array.isArray(resultData200)) {
result200 = [] as any;
for (let item of resultData200)
result200!.push(CardLevelResponseDto.fromJS(item));
}
return result200;
} else if (status === 401) {
const _responseText = response.data;
return throwException("Unauthorized", status, _responseText, _headers);
} else if (status === 403) {
const _responseText = response.data;
return throwException("Forbidden", status, _responseText, _headers);
} else if (status !== 200 && status !== 204) {
const _responseText = response.data;
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}
return Promise.resolve<CardLevelResponseDto[]>(<any>null);
}
/**
* Gets all existing cards and includes the level for the user if it has been set
* @param id The user identifier
* @return Success
*/
cards(id: string): Promise<UserCardResponseDto[]> {
let url_ = this.baseUrl + "/users/{id}/cards";
if (id === undefined || id === null)
throw new Error("The parameter 'id' must be defined.");
url_ = url_.replace("{id}", encodeURIComponent("" + id));
url_ = url_.replace(/[?&]$/, "");
let options_ = <AxiosRequestConfig>{
method: "GET",
url: url_,
headers: {
"Accept": "text/plain"
}
};
return this.instance.request(options_).then((_response: AxiosResponse) => {
return this.processCards(_response);
});
}
protected processCards(response: AxiosResponse): Promise<UserCardResponseDto[]> {
const status = response.status;
let _headers: any = {};
if (response.headers && typeof response.headers === "object") {
for (let k in response.headers) {
if (response.headers.hasOwnProperty(k)) {
_headers[k] = response.headers[k];
}
}
}
if (status === 200) {
const _responseText = response.data;
let result200: any = null;
let resultData200 = _responseText;
if (Array.isArray(resultData200)) {
result200 = [] as any;
for (let item of resultData200)
result200!.push(UserCardResponseDto.fromJS(item));
}
return result200;
} else if (status === 401) {
const _responseText = response.data;
return throwException("Unauthorized", status, _responseText, _headers);
} else if (status === 403) {
const _responseText = response.data;
return throwException("Forbidden", status, _responseText, _headers);
} else if (status !== 200 && status !== 204) {
const _responseText = response.data;
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}
return Promise.resolve<UserCardResponseDto[]>(<any>null);
}
}
export class SystemInfoDto implements ISystemInfoDto {
version!: string | undefined;
gitCommitHash?: string | undefined;
buildTimeUtc?: Date | undefined;
constructor(data?: ISystemInfoDto) {
if (data) {
for (var property in data) {
if (data.hasOwnProperty(property))
(<any>this)[property] = (<any>data)[property];
}
}
}
init(data?: any) {
if (data) {
this.version = data["version"];
this.gitCommitHash = data["gitCommitHash"];
this.buildTimeUtc = data["buildTimeUtc"] ? new Date(data["buildTimeUtc"].toString()) : <any>undefined;
}
}
static fromJS(data: any): SystemInfoDto {
data = typeof data === 'object' ? data : {};
let result = new SystemInfoDto();
result.init(data);
return result;
}
toJSON(data?: any) {
data = typeof data === 'object' ? data : {};
data["version"] = this.version;
data["gitCommitHash"] = this.gitCommitHash;
data["buildTimeUtc"] = this.buildTimeUtc ? this.buildTimeUtc.toISOString() : <any>undefined;
return data;
}
}
export interface ISystemInfoDto {
version: string | undefined;
gitCommitHash?: string | undefined;
buildTimeUtc?: Date | undefined;
}
export class CardLevelUpdateRequestDto implements ICardLevelUpdateRequestDto {
/** The user identifier */
userId!: string;
/** The card identifier */
cardId!: string;
/** The level of the card for the user (1-7). */
level!: number;
constructor(data?: ICardLevelUpdateRequestDto) {
if (data) {
for (var property in data) {
if (data.hasOwnProperty(property))
(<any>this)[property] = (<any>data)[property];
}
}
}
init(data?: any) {
if (data) {
this.userId = data["userId"];
this.cardId = data["cardId"];
this.level = data["level"];
}
}
static fromJS(data: any): CardLevelUpdateRequestDto {
data = typeof data === 'object' ? data : {};
let result = new CardLevelUpdateRequestDto();
result.init(data);
return result;
}
toJSON(data?: any) {
data = typeof data === 'object' ? data : {};
data["userId"] = this.userId;
data["cardId"] = this.cardId;
data["level"] = this.level;
return data;
}
}
export interface ICardLevelUpdateRequestDto {
/** The user identifier */
userId: string;
/** The card identifier */
cardId: string;
/** The level of the card for the user (1-7). */
level: number;
}
export class CardLevelResponseDto implements ICardLevelResponseDto {
/** The card level identifier */
id!: string;
/** The user identifier */
userId!: string;
/** The card identifier */
cardId!: string;
/** The level of the card for the user */
level!: number;
/** When the level has been last modified. */
levelLastModified?: Date | undefined;
constructor(data?: ICardLevelResponseDto) {
if (data) {
for (var property in data) {
if (data.hasOwnProperty(property))
(<any>this)[property] = (<any>data)[property];
}
}
}
init(data?: any) {
if (data) {
this.id = data["id"];
this.userId = data["userId"];
this.cardId = data["cardId"];
this.level = data["level"];
this.levelLastModified = data["levelLastModified"] ? new Date(data["levelLastModified"].toString()) : <any>undefined;
}
}
static fromJS(data: any): CardLevelResponseDto {
data = typeof data === 'object' ? data : {};
let result = new CardLevelResponseDto();
result.init(data);
return result;
}
toJSON(data?: any) {
data = typeof data === 'object' ? data : {};
data["id"] = this.id;
data["userId"] = this.userId;
data["cardId"] = this.cardId;
data["level"] = this.level;
data["levelLastModified"] = this.levelLastModified ? this.levelLastModified.toISOString() : <any>undefined;
return data;
}
}
export interface ICardLevelResponseDto {
/** The card level identifier */
id: string;
/** The user identifier */
userId: string;
/** The card identifier */
cardId: string;
/** The level of the card for the user */
level: number;
/** When the level has been last modified. */
levelLastModified?: Date | undefined;
}
export class CardResponseDto implements ICardResponseDto {
/** The card description. */
description?: string | undefined;
manaCost!: number;
/** The external identifier */
externalId?: string | undefined;
/** The theme identifier */
themeId!: string;
/** The rarity identifier. */
rarityId!: string;
/** The type identifier. */
typeId!: string;
/** The character type identifier. */
characterTypeId?: string | undefined;
/** The entity name */
name!: string | undefined;
/** The entity identifier */
id!: string;
/** The UTC time, when the entity has been created */
createdOnUtc!: Date;
/** The UTC time, when the entity has been last updated */
modifiedOnUtc!: Date;
/** The entity version. */
version!: string | undefined;
constructor(data?: ICardResponseDto) {
if (data) {
for (var property in data) {
if (data.hasOwnProperty(property))
(<any>this)[property] = (<any>data)[property];
}
}
}
init(data?: any) {
if (data) {
this.description = data["description"];
this.manaCost = data["manaCost"];
this.externalId = data["externalId"];
this.themeId = data["themeId"];
this.rarityId = data["rarityId"];
this.typeId = data["typeId"];
this.characterTypeId = data["characterTypeId"];
this.name = data["name"];
this.id = data["id"];
this.createdOnUtc = data["createdOnUtc"] ? new Date(data["createdOnUtc"].toString()) : <any>undefined;
this.modifiedOnUtc = data["modifiedOnUtc"] ? new Date(data["modifiedOnUtc"].toString()) : <any>undefined;
this.version = data["version"];
}
}
static fromJS(data: any): CardResponseDto {
data = typeof data === 'object' ? data : {};
let result = new CardResponseDto();
result.init(data);
return result;
}
toJSON(data?: any) {
data = typeof data === 'object' ? data : {};
data["description"] = this.description;
data["manaCost"] = this.manaCost;
data["externalId"] = this.externalId;
data["themeId"] = this.themeId;
data["rarityId"] = this.rarityId;
data["typeId"] = this.typeId;
data["characterTypeId"] = this.characterTypeId;
data["name"] = this.name;
data["id"] = this.id;
data["createdOnUtc"] = this.createdOnUtc ? this.createdOnUtc.toISOString() : <any>undefined;
data["modifiedOnUtc"] = this.modifiedOnUtc ? this.modifiedOnUtc.toISOString() : <any>undefined;
data["version"] = this.version;
return data;
}
}
export interface ICardResponseDto {
/** The card description. */
description?: string | undefined;
manaCost: number;
/** The external identifier */
externalId?: string | undefined;
/** The theme identifier */
themeId: string;
/** The rarity identifier. */
rarityId: string;
/** The type identifier. */
typeId: string;
/** The character type identifier. */
characterTypeId?: string | undefined;
/** The entity name */
name: string | undefined;
/** The entity identifier */
id: string;
/** The UTC time, when the entity has been created */
createdOnUtc: Date;
/** The UTC time, when the entity has been last updated */
modifiedOnUtc: Date;
/** The entity version. */
version: string | undefined;
}
/** Specifies a card type (e.g. Spell, Ranged, Fighter) */
export class CardTypeResponseDto implements ICardTypeResponseDto {
/** The entity name */
name!: string | undefined;
/** The entity identifier */
id!: string;
/** The UTC time, when the entity has been created */
createdOnUtc!: Date;
/** The UTC time, when the entity has been last updated */
modifiedOnUtc!: Date;
/** The entity version. */
version!: string | undefined;
constructor(data?: ICardTypeResponseDto) {
if (data) {
for (var property in data) {
if (data.hasOwnProperty(property))
(<any>this)[property] = (<any>data)[property];
}
}
}
init(data?: any) {
if (data) {
this.name = data["name"];
this.id = data["id"];
this.createdOnUtc = data["createdOnUtc"] ? new Date(data["createdOnUtc"].toString()) : <any>undefined;
this.modifiedOnUtc = data["modifiedOnUtc"] ? new Date(data["modifiedOnUtc"].toString()) : <any>undefined;
this.version = data["version"];
}
}
static fromJS(data: any): CardTypeResponseDto {
data = typeof data === 'object' ? data : {};
let result = new CardTypeResponseDto();
result.init(data);
return result;
}
toJSON(data?: any) {
data = typeof data === 'object' ? data : {};
data["name"] = this.name;
data["id"] = this.id;
data["createdOnUtc"] = this.createdOnUtc ? this.createdOnUtc.toISOString() : <any>undefined;
data["modifiedOnUtc"] = this.modifiedOnUtc ? this.modifiedOnUtc.toISOString() : <any>undefined;
data["version"] = this.version;
return data;
}
}
/** Specifies a card type (e.g. Spell, Ranged, Fighter) */
export interface ICardTypeResponseDto {
/** The entity name */
name: string | undefined;
/** The entity identifier */
id: string;
/** The UTC time, when the entity has been created */
createdOnUtc: Date;
/** The UTC time, when the entity has been last updated */
modifiedOnUtc: Date;
/** The entity version. */
version: string | undefined;
}
/** Specifies a card type (e.g. Assassin, Melee, Ranged) */
export class CharacterTypeResponseDto implements ICharacterTypeResponseDto {
/** The entity name */
name!: string | undefined;
/** The entity identifier */
id!: string;
/** The UTC time, when the entity has been created */
createdOnUtc!: Date;
/** The UTC time, when the entity has been last updated */
modifiedOnUtc!: Date;
/** The entity version. */
version!: string | undefined;
constructor(data?: ICharacterTypeResponseDto) {
if (data) {
for (var property in data) {
if (data.hasOwnProperty(property))
(<any>this)[property] = (<any>data)[property];
}
}
}
init(data?: any) {
if (data) {
this.name = data["name"];
this.id = data["id"];
this.createdOnUtc = data["createdOnUtc"] ? new Date(data["createdOnUtc"].toString()) : <any>undefined;
this.modifiedOnUtc = data["modifiedOnUtc"] ? new Date(data["modifiedOnUtc"].toString()) : <any>undefined;
this.version = data["version"];
}
}
static fromJS(data: any): CharacterTypeResponseDto {
data = typeof data === 'object' ? data : {};
let result = new CharacterTypeResponseDto();
result.init(data);
return result;
}
toJSON(data?: any) {
data = typeof data === 'object' ? data : {};
data["name"] = this.name;
data["id"] = this.id;
data["createdOnUtc"] = this.createdOnUtc ? this.createdOnUtc.toISOString() : <any>undefined;
data["modifiedOnUtc"] = this.modifiedOnUtc ? this.modifiedOnUtc.toISOString() : <any>undefined;
data["version"] = this.version;
return data;
}
}
/** Specifies a card type (e.g. Assassin, Melee, Ranged) */
export interface ICharacterTypeResponseDto {
/** The entity name */
name: string | undefined;
/** The entity identifier */
id: string;
/** The UTC time, when the entity has been created */
createdOnUtc: Date;
/** The UTC time, when the entity has been last updated */
modifiedOnUtc: Date;
/** The entity version. */
version: string | undefined;
}
/** Specifies a rarity (e.g. Common, Legendary) */
export class RarityResponseDto implements IRarityResponseDto {
/** The entity name */
name!: string | undefined;
/** The entity identifier */
id!: string;
/** The UTC time, when the entity has been created */
createdOnUtc!: Date;
/** The UTC time, when the entity has been last updated */
modifiedOnUtc!: Date;
/** The entity version. */
version!: string | undefined;
constructor(data?: IRarityResponseDto) {
if (data) {
for (var property in data) {
if (data.hasOwnProperty(property))
(<any>this)[property] = (<any>data)[property];
}
}
}
init(data?: any) {
if (data) {
this.name = data["name"];
this.id = data["id"];
this.createdOnUtc = data["createdOnUtc"] ? new Date(data["createdOnUtc"].toString()) : <any>undefined;
this.modifiedOnUtc = data["modifiedOnUtc"] ? new Date(data["modifiedOnUtc"].toString()) : <any>undefined;
this.version = data["version"];
}
}
static fromJS(data: any): RarityResponseDto {
data = typeof data === 'object' ? data : {};
let result = new RarityResponseDto();
result.init(data);
return result;
}
toJSON(data?: any) {
data = typeof data === 'object' ? data : {};
data["name"] = this.name;
data["id"] = this.id;
data["createdOnUtc"] = this.createdOnUtc ? this.createdOnUtc.toISOString() : <any>undefined;
data["modifiedOnUtc"] = this.modifiedOnUtc ? this.modifiedOnUtc.toISOString() : <any>undefined;
data["version"] = this.version;
return data;
}
}
/** Specifies a rarity (e.g. Common, Legendary) */
export interface IRarityResponseDto {
/** The entity name */
name: string | undefined;
/** The entity identifier */
id: string;
/** The UTC time, when the entity has been created */
createdOnUtc: Date;
/** The UTC time, when the entity has been last updated */
modifiedOnUtc: Date;
/** The entity version. */
version: string | undefined;
}
/** Specifies a theme (e.g. Sci-Fy, Adventure) */
export class ThemeResponseDto implements IThemeResponseDto {
/** The entity name */
name!: string | undefined;
/** The entity identifier */
id!: string;
/** The UTC time, when the entity has been created */
createdOnUtc!: Date;
/** The UTC time, when the entity has been last updated */
modifiedOnUtc!: Date;
/** The entity version. */
version!: string | undefined;
constructor(data?: IThemeResponseDto) {
if (data) {
for (var property in data) {
if (data.hasOwnProperty(property))
(<any>this)[property] = (<any>data)[property];
}
}
}
init(data?: any) {
if (data) {
this.name = data["name"];
this.id = data["id"];
this.createdOnUtc = data["createdOnUtc"] ? new Date(data["createdOnUtc"].toString()) : <any>undefined;
this.modifiedOnUtc = data["modifiedOnUtc"] ? new Date(data["modifiedOnUtc"].toString()) : <any>undefined;
this.version = data["version"];
}
}
static fromJS(data: any): ThemeResponseDto {
data = typeof data === 'object' ? data : {};
let result = new ThemeResponseDto();
result.init(data);
return result;
}
toJSON(data?: any) {
data = typeof data === 'object' ? data : {};
data["name"] = this.name;
data["id"] = this.id;
data["createdOnUtc"] = this.createdOnUtc ? this.createdOnUtc.toISOString() : <any>undefined;
data["modifiedOnUtc"] = this.modifiedOnUtc ? this.modifiedOnUtc.toISOString() : <any>undefined;
data["version"] = this.version;
return data;
}
}
/** Specifies a theme (e.g. Sci-Fy, Adventure) */
export interface IThemeResponseDto {
/** The entity name */
name: string | undefined;
/** The entity identifier */
id: string;
/** The UTC time, when the entity has been created */
createdOnUtc: Date;
/** The UTC time, when the entity has been last updated */
modifiedOnUtc: Date;
/** The entity version. */
version: string | undefined;
}
export class TeamMembershipRequestDto implements ITeamMembershipRequestDto {
/** The team identifier */
teamId!: string;
/** The user identifier */
userId!: string;
/** The comment */
comment?: string | undefined;
constructor(data?: ITeamMembershipRequestDto) {
if (data) {
for (var property in data) {
if (data.hasOwnProperty(property))
(<any>this)[property] = (<any>data)[property];
}
}
}
init(data?: any) {
if (data) {
this.teamId = data["teamId"];
this.userId = data["userId"];
this.comment = data["comment"];
}
}
static fromJS(data: any): TeamMembershipRequestDto {
data = typeof data === 'object' ? data : {};
let result = new TeamMembershipRequestDto();
result.init(data);
return result;
}
toJSON(data?: any) {
data = typeof data === 'object' ? data : {};
data["teamId"] = this.teamId;
data["userId"] = this.userId;
data["comment"] = this.comment;
return data;
}
}
export interface ITeamMembershipRequestDto {
/** The team identifier */
teamId: string;
/** The user identifier */
userId: string;
/** The comment */
comment?: string | undefined;
}
export class TeamMembershipRequestResponseDto implements ITeamMembershipRequestResponseDto {
/** The entity identifier */
id!: string;
/** The user identifier */
userId!: string;
/** The name of the user */
userName!: string | undefined;
/** The comment */
comment?: string | undefined;
teamId!: string;
teamName!: string | undefined;
requestDateUtc?: Date;
constructor(data?: ITeamMembershipRequestResponseDto) {
if (data) {
for (var property in data) {
if (data.hasOwnProperty(property))
(<any>this)[property] = (<any>data)[property];
}
}
}
init(data?: any) {
if (data) {
this.id = data["id"];
this.userId = data["userId"];
this.userName = data["userName"];
this.comment = data["comment"];
this.teamId = data["teamId"];
this.teamName = data["teamName"];
this.requestDateUtc = data["requestDateUtc"] ? new Date(data["requestDateUtc"].toString()) : <any>undefined;
}
}
static fromJS(data: any): TeamMembershipRequestResponseDto {
data = typeof data === 'object' ? data : {};
let result = new TeamMembershipRequestResponseDto();
result.init(data);
return result;
}
toJSON(data?: any) {
data = typeof data === 'object' ? data : {};
data["id"] = this.id;
data["userId"] = this.userId;
data["userName"] = this.userName;
data["comment"] = this.comment;
data["teamId"] = this.teamId;
data["teamName"] = this.teamName;
data["requestDateUtc"] = this.requestDateUtc ? this.requestDateUtc.toISOString() : <any>undefined;
return data;
}
}
export interface ITeamMembershipRequestResponseDto {
/** The entity identifier */
id: string;
/** The user identifier */
userId: string;
/** The name of the user */
userName: string | undefined;
/** The comment */
comment?: string | undefined;
teamId: string;
teamName: string | undefined;
requestDateUtc?: Date;
}
export class TeamCreateRequestDto implements ITeamCreateRequestDto {
/** The team name */
name!: string | undefined;
constructor(data?: ITeamCreateRequestDto) {
if (data) {
for (var property in data) {
if (data.hasOwnProperty(property))
(<any>this)[property] = (<any>data)[property];
}
}
}
init(data?: any) {
if (data) {
this.name = data["name"];
}
}
static fromJS(data: any): TeamCreateRequestDto {
data = typeof data === 'object' ? data : {};
let result = new TeamCreateRequestDto();
result.init(data);
return result;
}
toJSON(data?: any) {
data = typeof data === 'object' ? data : {};
data["name"] = this.name;
return data;
}
}
export interface ITeamCreateRequestDto {
/** The team name */
name: string | undefined;
}
export class TeamResponseDto implements ITeamResponseDto {
/** The federation identifier */
federationId?: string | undefined;
/** The avatar */
avatar?: string | undefined;
/** The description */
description?: string | undefined;
/** The entity name */
name!: string | undefined;
/** The entity identifier */
id!: string;
/** The UTC time, when the entity has been created */
createdOnUtc!: Date;
/** The UTC time, when the entity has been last updated */
modifiedOnUtc!: Date;
/** The entity version. */
version!: string | undefined;
constructor(data?: ITeamResponseDto) {
if (data) {
for (var property in data) {
if (data.hasOwnProperty(property))
(<any>this)[property] = (<any>data)[property];
}
}
}
init(data?: any) {
if (data) {
this.federationId = data["federationId"];
this.avatar = data["avatar"];
this.description = data["description"];
this.name = data["name"];
this.id = data["id"];
this.createdOnUtc = data["createdOnUtc"] ? new Date(data["createdOnUtc"].toString()) : <any>undefined;
this.modifiedOnUtc = data["modifiedOnUtc"] ? new Date(data["modifiedOnUtc"].toString()) : <any>undefined;
this.version = data["version"];
}
}
static fromJS(data: any): TeamResponseDto {
data = typeof data === 'object' ? data : {};
let result = new TeamResponseDto();
result.init(data);
return result;
}
toJSON(data?: any) {
data = typeof data === 'object' ? data : {};
data["federationId"] = this.federationId;
data["avatar"] = this.avatar;
data["description"] = this.description;
data["name"] = this.name;
data["id"] = this.id;
data["createdOnUtc"] = this.createdOnUtc ? this.createdOnUtc.toISOString() : <any>undefined;
data["modifiedOnUtc"] = this.modifiedOnUtc ? this.modifiedOnUtc.toISOString() : <any>undefined;
data["version"] = this.version;
return data;
}
}
export interface ITeamResponseDto {
/** The federation identifier */
federationId?: string | undefined;
/** The avatar */
avatar?: string | undefined;
/** The description */
description?: string | undefined;
/** The entity name */
name: string | undefined;
/** The entity identifier */
id: string;
/** The UTC time, when the entity has been created */
createdOnUtc: Date;
/** The UTC time, when the entity has been last updated */
modifiedOnUtc: Date;
/** The entity version. */
version: string | undefined;
}
export class TeamUpdateRequestDto implements ITeamUpdateRequestDto {
/** The name of the team */
name?: string | undefined;
/** The description */
description?: string | undefined;
/** The team avatar */
avatar?: string | undefined;
/** The federation identifier */
federationId?: string | undefined;
/** The identifier of the entity to update */
id!: string;
/** Only the properties specified in this list will be updated. If NULL or empty, all properties will be updated. */
propertiesToUpdate?: string[] | undefined;
/** The entity version */
version!: string | undefined;
constructor(data?: ITeamUpdateRequestDto) {
if (data) {
for (var property in data) {
if (data.hasOwnProperty(property))
(<any>this)[property] = (<any>data)[property];
}
}
}
init(data?: any) {
if (data) {
this.name = data["name"];
this.description = data["description"];
this.avatar = data["avatar"];
this.federationId = data["federationId"];
this.id = data["id"];
if (Array.isArray(data["propertiesToUpdate"])) {
this.propertiesToUpdate = [] as any;
for (let item of data["propertiesToUpdate"])
this.propertiesToUpdate!.push(item);
}
this.version = data["version"];
}
}
static fromJS(data: any): TeamUpdateRequestDto {
data = typeof data === 'object' ? data : {};
let result = new TeamUpdateRequestDto();
result.init(data);
return result;
}
toJSON(data?: any) {
data = typeof data === 'object' ? data : {};
data["name"] = this.name;
data["description"] = this.description;
data["avatar"] = this.avatar;
data["federationId"] = this.federationId;
data["id"] = this.id;
if (Array.isArray(this.propertiesToUpdate)) {
data["propertiesToUpdate"] = [];
for (let item of this.propertiesToUpdate)
data["propertiesToUpdate"].push(item);
}
data["version"] = this.version;
return data;
}
}
export interface ITeamUpdateRequestDto {
/** The name of the team */
name?: string | undefined;
/** The description */
description?: string | undefined;
/** The team avatar */
avatar?: string | undefined;
/** The federation identifier */
federationId?: string | undefined;
/** The identifier of the entity to update */
id: string;
/** Only the properties specified in this list will be updated. If NULL or empty, all properties will be updated. */
propertiesToUpdate?: string[] | undefined;
/** The entity version */
version: string | undefined;
}
export enum UserProfileVisibility {
_0 = 0,
_1 = 1,
_2 = 2,
}
export class UserResponseDto implements IUserResponseDto {
/** The South Park Phone Destroyer in-game user name */
sppdName!: string | undefined;
/** The email address */
email!: string | undefined;
/** The application role the current user has */
applicationRole!: string | undefined;
/** The team identifier */
teamId?: string | undefined;
/** The name of the team. */
teamName?: string | undefined;
/** The team role */
teamRole?: string | undefined;
/** The federation identifier */
federationId?: string | undefined;
/** The federation role */
federationRole?: string | undefined;
profileVisibility!: UserProfileVisibility;
/** The avatar */
avatar?: string | undefined;
/** The description */
description?: string | undefined;
/** The entity name */
name!: string | undefined;
/** The entity identifier */
id!: string;
/** The UTC time, when the entity has been created */
createdOnUtc!: Date;
/** The UTC time, when the entity has been last updated */
modifiedOnUtc!: Date;
/** The entity version. */
version!: string | undefined;
constructor(data?: IUserResponseDto) {
if (data) {
for (var property in data) {
if (data.hasOwnProperty(property))
(<any>this)[property] = (<any>data)[property];
}
}
}
init(data?: any) {
if (data) {
this.sppdName = data["sppdName"];
this.email = data["email"];
this.applicationRole = data["applicationRole"];
this.teamId = data["teamId"];
this.teamName = data["teamName"];
this.teamRole = data["teamRole"];
this.federationId = data["federationId"];
this.federationRole = data["federationRole"];
this.profileVisibility = data["profileVisibility"];
this.avatar = data["avatar"];
this.description = data["description"];
this.name = data["name"];
this.id = data["id"];
this.createdOnUtc = data["createdOnUtc"] ? new Date(data["createdOnUtc"].toString()) : <any>undefined;
this.modifiedOnUtc = data["modifiedOnUtc"] ? new Date(data["modifiedOnUtc"].toString()) : <any>undefined;
this.version = data["version"];
}
}
static fromJS(data: any): UserResponseDto {
data = typeof data === 'object' ? data : {};
let result = new UserResponseDto();
result.init(data);
return result;
}
toJSON(data?: any) {
data = typeof data === 'object' ? data : {};
data["sppdName"] = this.sppdName;
data["email"] = this.email;
data["applicationRole"] = this.applicationRole;
data["teamId"] = this.teamId;
data["teamName"] = this.teamName;
data["teamRole"] = this.teamRole;
data["federationId"] = this.federationId;
data["federationRole"] = this.federationRole;
data["profileVisibility"] = this.profileVisibility;
data["avatar"] = this.avatar;
data["description"] = this.description;
data["name"] = this.name;
data["id"] = this.id;
data["createdOnUtc"] = this.createdOnUtc ? this.createdOnUtc.toISOString() : <any>undefined;
data["modifiedOnUtc"] = this.modifiedOnUtc ? this.modifiedOnUtc.toISOString() : <any>undefined;
data["version"] = this.version;
return data;
}
}
export interface IUserResponseDto {
/** The South Park Phone Destroyer in-game user name */
sppdName: string | undefined;
/** The email address */
email: string | undefined;
/** The application role the current user has */
applicationRole: string | undefined;
/** The team identifier */
teamId?: string | undefined;
/** The name of the team. */
teamName?: string | undefined;
/** The team role */
teamRole?: string | undefined;
/** The federation identifier */
federationId?: string | undefined;
/** The federation role */
federationRole?: string | undefined;
profileVisibility: UserProfileVisibility;
/** The avatar */
avatar?: string | undefined;
/** The description */
description?: string | undefined;
/** The entity name */
name: string | undefined;
/** The entity identifier */
id: string;
/** The UTC time, when the entity has been created */
createdOnUtc: Date;
/** The UTC time, when the entity has been last updated */
modifiedOnUtc: Date;
/** The entity version. */
version: string | undefined;
}
export class UserCreateRequestDto implements IUserCreateRequestDto {
/** The user name */
name!: string | undefined;
/** The South Park Phone Destroyer in-game user name */
sppdName!: string | undefined;
/** The email address */
email!: string | undefined;
/** MD5 hash of the user password */
passwordMd5!: string | undefined;
constructor(data?: IUserCreateRequestDto) {
if (data) {
for (var property in data) {
if (data.hasOwnProperty(property))
(<any>this)[property] = (<any>data)[property];
}
}
}
init(data?: any) {
if (data) {
this.name = data["name"];
this.sppdName = data["sppdName"];
this.email = data["email"];
this.passwordMd5 = data["passwordMd5"];
}
}
static fromJS(data: any): UserCreateRequestDto {
data = typeof data === 'object' ? data : {};
let result = new UserCreateRequestDto();
result.init(data);
return result;
}
toJSON(data?: any) {
data = typeof data === 'object' ? data : {};
data["name"] = this.name;
data["sppdName"] = this.sppdName;
data["email"] = this.email;
data["passwordMd5"] = this.passwordMd5;
return data;
}
}
export interface IUserCreateRequestDto {
/** The user name */
name: string | undefined;
/** The South Park Phone Destroyer in-game user name */
sppdName: string | undefined;
/** The email address */
email: string | undefined;
/** MD5 hash of the user password */
passwordMd5: string | undefined;
}
export class UserUpdateRequestDto implements IUserUpdateRequestDto {
/** The user name */
name?: string | undefined;
/** The South Park Phone Destroyer in-game user name */
sppdName?: string | undefined;
/** The email address */
email?: string | undefined;
/** The avatar of the user */
avatar?: string | undefined;
/** The description */
description?: string | undefined;
/** MD5 hash of the user password */
passwordMd5?: string | undefined;
profileVisibility?: UserProfileVisibility;
/** The identifier of the entity to update */
id!: string;
/** Only the properties specified in this list will be updated. If NULL or empty, all properties will be updated. */
propertiesToUpdate?: string[] | undefined;
/** The entity version */
version!: string | undefined;
constructor(data?: IUserUpdateRequestDto) {
if (data) {
for (var property in data) {
if (data.hasOwnProperty(property))
(<any>this)[property] = (<any>data)[property];
}
}
}
init(data?: any) {
if (data) {
this.name = data["name"];
this.sppdName = data["sppdName"];
this.email = data["email"];
this.avatar = data["avatar"];
this.description = data["description"];
this.passwordMd5 = data["passwordMd5"];
this.profileVisibility = data["profileVisibility"];
this.id = data["id"];
if (Array.isArray(data["propertiesToUpdate"])) {
this.propertiesToUpdate = [] as any;
for (let item of data["propertiesToUpdate"])
this.propertiesToUpdate!.push(item);
}
this.version = data["version"];
}
}
static fromJS(data: any): UserUpdateRequestDto {
data = typeof data === 'object' ? data : {};
let result = new UserUpdateRequestDto();
result.init(data);
return result;
}
toJSON(data?: any) {
data = typeof data === 'object' ? data : {};
data["name"] = this.name;
data["sppdName"] = this.sppdName;
data["email"] = this.email;
data["avatar"] = this.avatar;
data["description"] = this.description;
data["passwordMd5"] = this.passwordMd5;
data["profileVisibility"] = this.profileVisibility;
data["id"] = this.id;
if (Array.isArray(this.propertiesToUpdate)) {
data["propertiesToUpdate"] = [];
for (let item of this.propertiesToUpdate)
data["propertiesToUpdate"].push(item);
}
data["version"] = this.version;
return data;
}
}
export interface IUserUpdateRequestDto {
/** The user name */
name?: string | undefined;
/** The South Park Phone Destroyer in-game user name */
sppdName?: string | undefined;
/** The email address */
email?: string | undefined;
/** The avatar of the user */
avatar?: string | undefined;
/** The description */
description?: string | undefined;
/** MD5 hash of the user password */
passwordMd5?: string | undefined;
profileVisibility?: UserProfileVisibility;
/** The identifier of the entity to update */
id: string;
/** Only the properties specified in this list will be updated. If NULL or empty, all properties will be updated. */
propertiesToUpdate?: string[] | undefined;
/** The entity version */
version: string | undefined;
}
export class AuthorizationRequestDto implements IAuthorizationRequestDto {
/** User name */
name!: string | undefined;
/** MD5 hash of the user password */
passwordMd5!: string | undefined;
constructor(data?: IAuthorizationRequestDto) {
if (data) {
for (var property in data) {
if (data.hasOwnProperty(property))
(<any>this)[property] = (<any>data)[property];
}
}
}
init(data?: any) {
if (data) {
this.name = data["name"];
this.passwordMd5 = data["passwordMd5"];
}
}
static fromJS(data: any): AuthorizationRequestDto {
data = typeof data === 'object' ? data : {};
let result = new AuthorizationRequestDto();
result.init(data);
return result;
}
toJSON(data?: any) {
data = typeof data === 'object' ? data : {};
data["name"] = this.name;
data["passwordMd5"] = this.passwordMd5;
return data;
}
}
export interface IAuthorizationRequestDto {
/** User name */
name: string | undefined;
/** MD5 hash of the user password */
passwordMd5: string | undefined;
}
export class UserAuthorizationResponseDto implements IUserAuthorizationResponseDto {
/** The token which will have to be set as bearer in the HTTP authorization header for subsequent calls requiring
authentication */
token!: string | undefined;
/** The South Park Phone Destroyer in-game user name */
sppdName!: string | undefined;
/** The email address */
email!: string | undefined;
/** The application role the current user has */
applicationRole!: string | undefined;
/** The team identifier */
teamId?: string | undefined;
/** The name of the team. */
teamName?: string | undefined;
/** The team role */
teamRole?: string | undefined;
/** The federation identifier */
federationId?: string | undefined;
/** The federation role */
federationRole?: string | undefined;
profileVisibility!: UserProfileVisibility;
/** The avatar */
avatar?: string | undefined;
/** The description */
description?: string | undefined;
/** The entity name */
name!: string | undefined;
/** The entity identifier */
id!: string;
/** The UTC time, when the entity has been created */
createdOnUtc!: Date;
/** The UTC time, when the entity has been last updated */
modifiedOnUtc!: Date;
/** The entity version. */
version!: string | undefined;
constructor(data?: IUserAuthorizationResponseDto) {
if (data) {
for (var property in data) {
if (data.hasOwnProperty(property))
(<any>this)[property] = (<any>data)[property];
}
}
}
init(data?: any) {
if (data) {
this.token = data["token"];
this.sppdName = data["sppdName"];
this.email = data["email"];
this.applicationRole = data["applicationRole"];
this.teamId = data["teamId"];
this.teamName = data["teamName"];
this.teamRole = data["teamRole"];
this.federationId = data["federationId"];
this.federationRole = data["federationRole"];
this.profileVisibility = data["profileVisibility"];
this.avatar = data["avatar"];
this.description = data["description"];
this.name = data["name"];
this.id = data["id"];
this.createdOnUtc = data["createdOnUtc"] ? new Date(data["createdOnUtc"].toString()) : <any>undefined;
this.modifiedOnUtc = data["modifiedOnUtc"] ? new Date(data["modifiedOnUtc"].toString()) : <any>undefined;
this.version = data["version"];
}
}
static fromJS(data: any): UserAuthorizationResponseDto {
data = typeof data === 'object' ? data : {};
let result = new UserAuthorizationResponseDto();
result.init(data);
return result;
}
toJSON(data?: any) {
data = typeof data === 'object' ? data : {};
data["token"] = this.token;
data["sppdName"] = this.sppdName;
data["email"] = this.email;
data["applicationRole"] = this.applicationRole;
data["teamId"] = this.teamId;
data["teamName"] = this.teamName;
data["teamRole"] = this.teamRole;
data["federationId"] = this.federationId;
data["federationRole"] = this.federationRole;
data["profileVisibility"] = this.profileVisibility;
data["avatar"] = this.avatar;
data["description"] = this.description;
data["name"] = this.name;
data["id"] = this.id;
data["createdOnUtc"] = this.createdOnUtc ? this.createdOnUtc.toISOString() : <any>undefined;
data["modifiedOnUtc"] = this.modifiedOnUtc ? this.modifiedOnUtc.toISOString() : <any>undefined;
data["version"] = this.version;
return data;
}
}
export interface IUserAuthorizationResponseDto {
/** The token which will have to be set as bearer in the HTTP authorization header for subsequent calls requiring
authentication */
token: string | undefined;
/** The South Park Phone Destroyer in-game user name */
sppdName: string | undefined;
/** The email address */
email: string | undefined;
/** The application role the current user has */
applicationRole: string | undefined;
/** The team identifier */
teamId?: string | undefined;
/** The name of the team. */
teamName?: string | undefined;
/** The team role */
teamRole?: string | undefined;
/** The federation identifier */
federationId?: string | undefined;
/** The federation role */
federationRole?: string | undefined;
profileVisibility: UserProfileVisibility;
/** The avatar */
avatar?: string | undefined;
/** The description */
description?: string | undefined;
/** The entity name */
name: string | undefined;
/** The entity identifier */
id: string;
/** The UTC time, when the entity has been created */
createdOnUtc: Date;
/** The UTC time, when the entity has been last updated */
modifiedOnUtc: Date;
/** The entity version. */
version: string | undefined;
}
export class UserCardResponseDto implements IUserCardResponseDto {
/** The card identifier */
cardId!: string;
/** The name of the card */
cardName!: string | undefined;
/** The user identifier */
userId!: string;
/** The theme identifier */
themeId!: string;
/** The rarity identifier. */
rarityId!: string;
/** The type identifier. */
typeId!: string;
/** The character type identifier. */
characterTypeId!: string | undefined;
/** The level (NULL if not set) */
level?: number | undefined;
/** When the level has been last modified. */
levelLastModified?: Date | undefined;
constructor(data?: IUserCardResponseDto) {
if (data) {
for (var property in data) {
if (data.hasOwnProperty(property))
(<any>this)[property] = (<any>data)[property];
}
}
}
init(data?: any) {
if (data) {
this.cardId = data["cardId"];
this.cardName = data["cardName"];
this.userId = data["userId"];
this.themeId = data["themeId"];
this.rarityId = data["rarityId"];
this.typeId = data["typeId"];
this.characterTypeId = data["characterTypeId"];
this.level = data["level"];
this.levelLastModified = data["levelLastModified"] ? new Date(data["levelLastModified"].toString()) : <any>undefined;
}
}
static fromJS(data: any): UserCardResponseDto {
data = typeof data === 'object' ? data : {};
let result = new UserCardResponseDto();
result.init(data);
return result;
}
toJSON(data?: any) {
data = typeof data === 'object' ? data : {};
data["cardId"] = this.cardId;
data["cardName"] = this.cardName;
data["userId"] = this.userId;
data["themeId"] = this.themeId;
data["rarityId"] = this.rarityId;
data["typeId"] = this.typeId;
data["characterTypeId"] = this.characterTypeId;
data["level"] = this.level;
data["levelLastModified"] = this.levelLastModified ? this.levelLastModified.toISOString() : <any>undefined;
return data;
}
}
export interface IUserCardResponseDto {
/** The card identifier */
cardId: string;
/** The name of the card */
cardName: string | undefined;
/** The user identifier */
userId: string;
/** The theme identifier */
themeId: string;
/** The rarity identifier. */
rarityId: string;
/** The type identifier. */
typeId: string;
/** The character type identifier. */
characterTypeId: string | undefined;
/** The level (NULL if not set) */
level?: number | undefined;
/** When the level has been last modified. */
levelLastModified?: Date | undefined;
}
export class ApiException extends Error {
message: string;
status: number;
response: string;
headers: { [key: string]: any; };
result: any;
constructor(message: string, status: number, response: string, headers: { [key: string]: any; }, result: any) {
super();
this.message = message;
this.status = status;
this.response = response;
this.headers = headers;
this.result = result;
}
protected isApiException = true;
static isApiException(obj: any): obj is ApiException {
return obj.isApiException === true;
}
}
function throwException(message: string, status: number, response: string, headers: { [key: string]: any; }, result?: any): any {
if (result !== null && result !== undefined)
throw result;
else
throw new ApiException(message, status, response, headers, null);
}
If required, you can easily reproduce this by (see prerequisits in README.md in case of an issue):
dotnet restore ./Sppd.TeamTuner/Sppd.TeamTuner.csprojdotnet run --project ./Sppd.TeamTuner/Sppd.TeamTuner.csproj --launch-profile Development@RicoSuter Do you have an idea how I can solve this issue? respectively in which direction to dig to find a solution?
As I've noticed that the header accept field is different (2: "application/json", 3: "text/plain") I've tried forcing it to "application/json" by
settings.PostProcess = document => document.Produces = new List<string>
{
"application/json"
};
And
with this I get:
headers: {
"Accept": "application/json"
}
The generate methods look _better_, now the method names are prefixed with the controller name. E.g.
/**
* Gets the user
* @param id The user identifier
*/
users_GetUserByUserId(id: string): Promise<UserResponseDto> {
let url_ = this.baseUrl + "/users/{id}";
if (id === undefined || id === null)
throw new Error("The parameter 'id' must be defined.");
url_ = url_.replace("{id}", encodeURIComponent("" + id));
url_ = url_.replace(/[?&]$/, "");
let options_ = <AxiosRequestConfig>{
method: "GET",
url: url_,
headers: {
"Accept": "application/json"
}
};
return this.instance.request(options_).then((_response: AxiosResponse) => {
return this.processUsers_GetUserByUserId(_response);
});
}
I have the same problem. After updating to dotnet core 3 and updating Swashbuckle.AspNetCore the client generated files are different. @taconaut did you find a solution for this?