Skip to content

Commit

Permalink
Type "Common_Message" (struct) description has changed from "NULL" to…
Browse files Browse the repository at this point in the history
… "Common error message"
  • Loading branch information
SDKgen-Bot committed Nov 15, 2024
1 parent cd8d5b7 commit 5ecec02
Show file tree
Hide file tree
Showing 52 changed files with 1,009 additions and 622 deletions.
2 changes: 1 addition & 1 deletion sdkgen.lock

Large diffs are not rendered by default.

36 changes: 22 additions & 14 deletions src/AuthorizationTag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {CommonMessageException} from "./CommonMessageException";
export class AuthorizationTag extends TagAbstract {
/**
* @returns {Promise<BackendUser>}
* @throws {CommonMessageExceptionException}
* @throws {CommonMessageException}
* @throws {ClientException}
*/
public async getWhoami(): Promise<BackendUser> {
Expand All @@ -24,6 +24,8 @@ export class AuthorizationTag extends TagAbstract {
let params: AxiosRequestConfig = {
url: url,
method: 'GET',
headers: {
},
params: this.parser.query({
}, [
]),
Expand All @@ -36,12 +38,13 @@ export class AuthorizationTag extends TagAbstract {
if (error instanceof ClientException) {
throw error;
} else if (axios.isAxiosError(error) && error.response) {
switch (error.response.status) {
case 500:
throw new CommonMessageException(error.response.data);
default:
throw new UnknownStatusCodeException('The server returned an unknown status code');
const statusCode = error.response.status;

if (statusCode === 500) {
throw new CommonMessageException(error.response.data);
}

throw new UnknownStatusCodeException('The server returned an unknown status code: ' + statusCode);
} else {
throw new ClientException('An unknown error occurred: ' + String(error));
}
Expand All @@ -50,7 +53,7 @@ export class AuthorizationTag extends TagAbstract {

/**
* @returns {Promise<CommonMessage>}
* @throws {CommonMessageExceptionException}
* @throws {CommonMessageException}
* @throws {ClientException}
*/
public async revoke(): Promise<CommonMessage> {
Expand All @@ -60,6 +63,8 @@ export class AuthorizationTag extends TagAbstract {
let params: AxiosRequestConfig = {
url: url,
method: 'POST',
headers: {
},
params: this.parser.query({
}, [
]),
Expand All @@ -72,14 +77,17 @@ export class AuthorizationTag extends TagAbstract {
if (error instanceof ClientException) {
throw error;
} else if (axios.isAxiosError(error) && error.response) {
switch (error.response.status) {
case 400:
throw new CommonMessageException(error.response.data);
case 500:
throw new CommonMessageException(error.response.data);
default:
throw new UnknownStatusCodeException('The server returned an unknown status code');
const statusCode = error.response.status;

if (statusCode === 400) {
throw new CommonMessageException(error.response.data);
}

if (statusCode === 500) {
throw new CommonMessageException(error.response.data);
}

throw new UnknownStatusCodeException('The server returned an unknown status code: ' + statusCode);
} else {
throw new ClientException('An unknown error occurred: ' + String(error));
}
Expand Down
2 changes: 2 additions & 0 deletions src/BackendApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import {CommonMetadata} from "./CommonMetadata";
import {BackendToken} from "./BackendToken";

export interface BackendApp {
id?: number
userId?: number
Expand All @@ -19,3 +20,4 @@ export interface BackendApp {
scopes?: Array<string>
tokens?: Array<BackendToken>
}

1 change: 1 addition & 0 deletions src/BackendToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ export interface BackendToken {
expire?: string
date?: string
}

2 changes: 2 additions & 0 deletions src/BackendUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import {BackendApp} from "./BackendApp";
import {CommonMetadata} from "./CommonMetadata";

export interface BackendUser {
id?: number
roleId?: number
Expand All @@ -18,3 +19,4 @@ export interface BackendUser {
metadata?: CommonMetadata
date?: string
}

58 changes: 32 additions & 26 deletions src/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,47 +6,48 @@
import axios, {AxiosRequestConfig} from "axios";
import {ClientAbstract, CredentialsInterface, TokenStoreInterface} from "sdkgen-client"
import {OAuth2} from "sdkgen-client"
import {Anonymous} from "sdkgen-client"
import {ClientException, UnknownStatusCodeException} from "sdkgen-client";

import {TagTag} from "./TagTag";
import {StarTag} from "./StarTag";
import {TriggerTag} from "./TriggerTag";
import {PullRequestTag} from "./PullRequestTag";
import {IssueTag} from "./IssueTag";
import {ExploreTag} from "./ExploreTag";
import {DocumentTag} from "./DocumentTag";
import {CommitTag} from "./CommitTag";
import {AuthorizationTag} from "./AuthorizationTag";
import {CommitTag} from "./CommitTag";
import {DocumentTag} from "./DocumentTag";
import {ExploreTag} from "./ExploreTag";
import {IssueTag} from "./IssueTag";
import {MetaTag} from "./MetaTag";
import {PullRequestTag} from "./PullRequestTag";
import {StarTag} from "./StarTag";
import {TagTag} from "./TagTag";
import {TriggerTag} from "./TriggerTag";

export class Client extends ClientAbstract {
public tag(): TagTag
public authorization(): AuthorizationTag
{
return new TagTag(
return new AuthorizationTag(
this.httpClient,
this.parser
);
}

public star(): StarTag
public commit(): CommitTag
{
return new StarTag(
return new CommitTag(
this.httpClient,
this.parser
);
}

public trigger(): TriggerTag
public document(): DocumentTag
{
return new TriggerTag(
return new DocumentTag(
this.httpClient,
this.parser
);
}

public pullRequest(): PullRequestTag
public explore(): ExploreTag
{
return new PullRequestTag(
return new ExploreTag(
this.httpClient,
this.parser
);
Expand All @@ -60,41 +61,41 @@ export class Client extends ClientAbstract {
);
}

public explore(): ExploreTag
public meta(): MetaTag
{
return new ExploreTag(
return new MetaTag(
this.httpClient,
this.parser
);
}

public document(): DocumentTag
public pullRequest(): PullRequestTag
{
return new DocumentTag(
return new PullRequestTag(
this.httpClient,
this.parser
);
}

public commit(): CommitTag
public star(): StarTag
{
return new CommitTag(
return new StarTag(
this.httpClient,
this.parser
);
}

public authorization(): AuthorizationTag
public tag(): TagTag
{
return new AuthorizationTag(
return new TagTag(
this.httpClient,
this.parser
);
}

public meta(): MetaTag
public trigger(): TriggerTag
{
return new MetaTag(
return new TriggerTag(
this.httpClient,
this.parser
);
Expand All @@ -106,4 +107,9 @@ export class Client extends ClientAbstract {
{
return new Client('https://api.typehub.cloud/', new OAuth2(clientId, clientSecret, 'https://api.typehub.cloud/authorization/token', '', tokenStore, scopes));
}

public static buildAnonymous(): Client
{
return new Client('https://api.typehub.cloud/', new Anonymous());
}
}
1 change: 1 addition & 0 deletions src/Collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ export interface Collection<T> {
itemsPerPage?: number
entry?: Array<T>
}

2 changes: 2 additions & 0 deletions src/Comment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import {User} from "./User";
import {CommentReactions} from "./CommentReactions";

export interface Comment {
id?: number
user?: User
Expand All @@ -14,3 +15,4 @@ export interface Comment {
updateDate?: string
insertDate?: string
}

5 changes: 4 additions & 1 deletion src/CommentCollection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,7 @@

import {Collection} from "./Collection";
import {Comment} from "./Comment";
export type CommentCollection = Collection<Comment>;

export interface CommentCollection extends Collection<Comment> {
}

2 changes: 2 additions & 0 deletions src/CommentCreate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@
*/

import {Comment} from "./Comment";

export interface CommentCreate extends Comment {
}

1 change: 1 addition & 0 deletions src/CommentReactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ export interface CommentReactions {
rocket?: number
eyes?: number
}

2 changes: 2 additions & 0 deletions src/Commit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import {Document} from "./Document";
import {User} from "./User";
import {CommitPrevious} from "./CommitPrevious";

export interface Commit {
id?: number
document?: Document
Expand All @@ -16,3 +17,4 @@ export interface Commit {
spec?: any
insertDate?: string
}

5 changes: 4 additions & 1 deletion src/CommitCollection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,7 @@

import {Collection} from "./Collection";
import {Commit} from "./Commit";
export type CommitCollection = Collection<Commit>;

export interface CommitCollection extends Collection<Commit> {
}

1 change: 1 addition & 0 deletions src/CommitPrevious.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ export interface CommitPrevious {
spec?: any
insertDate?: string
}

Loading

0 comments on commit 5ecec02

Please sign in to comment.