217 lines
11 KiB
TypeScript
217 lines
11 KiB
TypeScript
/**
|
|
* dex API
|
|
*
|
|
*
|
|
*
|
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
* https://openapi-generator.tech
|
|
* Do not edit the class manually.
|
|
*/
|
|
/* tslint:disable:no-unused-variable member-ordering */
|
|
|
|
import { Inject, Injectable, Optional } from '@angular/core';
|
|
import { HttpClient, HttpHeaders, HttpParams,
|
|
HttpResponse, HttpEvent, HttpParameterCodec, HttpContext
|
|
} from '@angular/common/http';
|
|
import { CustomHttpParameterCodec } from '../encoder';
|
|
import { Observable } from 'rxjs';
|
|
|
|
// @ts-ignore
|
|
import { Deck } from '../model/deck';
|
|
|
|
// @ts-ignore
|
|
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
|
import { Configuration } from '../configuration';
|
|
import { BaseService } from '../api.base.service';
|
|
|
|
|
|
|
|
@Injectable({
|
|
providedIn: 'root'
|
|
})
|
|
export class DeckControllerService extends BaseService {
|
|
|
|
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
|
super(basePath, configuration);
|
|
}
|
|
|
|
/**
|
|
* Add Card To Deck
|
|
* @param cardId
|
|
* @param deckName
|
|
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
|
* @param reportProgress flag to report request and response progress.
|
|
*/
|
|
public apiDecksDeckNameCardIdPost(cardId: number, deckName: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<object>;
|
|
public apiDecksDeckNameCardIdPost(cardId: number, deckName: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<object>>;
|
|
public apiDecksDeckNameCardIdPost(cardId: number, deckName: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<object>>;
|
|
public apiDecksDeckNameCardIdPost(cardId: number, deckName: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
|
if (cardId === null || cardId === undefined) {
|
|
throw new Error('Required parameter cardId was null or undefined when calling apiDecksDeckNameCardIdPost.');
|
|
}
|
|
if (deckName === null || deckName === undefined) {
|
|
throw new Error('Required parameter deckName was null or undefined when calling apiDecksDeckNameCardIdPost.');
|
|
}
|
|
|
|
let localVarHeaders = this.defaultHeaders;
|
|
|
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
|
'application/json'
|
|
]);
|
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
|
}
|
|
|
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
|
|
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
|
|
|
|
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
|
if (localVarHttpHeaderAcceptSelected) {
|
|
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
|
responseType_ = 'text';
|
|
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
|
responseType_ = 'json';
|
|
} else {
|
|
responseType_ = 'blob';
|
|
}
|
|
}
|
|
|
|
let localVarPath = `/api/decks/${this.configuration.encodeParam({name: "deckName", value: deckName, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}/${this.configuration.encodeParam({name: "cardId", value: cardId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int64"})}`;
|
|
return this.httpClient.request<object>('post', `${this.configuration.basePath}${localVarPath}`,
|
|
{
|
|
context: localVarHttpContext,
|
|
responseType: <any>responseType_,
|
|
withCredentials: this.configuration.withCredentials,
|
|
headers: localVarHeaders,
|
|
observe: observe,
|
|
transferCache: localVarTransferCache,
|
|
reportProgress: reportProgress
|
|
}
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Get Deck
|
|
* @param name
|
|
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
|
* @param reportProgress flag to report request and response progress.
|
|
*/
|
|
public apiDecksGet(name: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<Deck>;
|
|
public apiDecksGet(name: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<Deck>>;
|
|
public apiDecksGet(name: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<Deck>>;
|
|
public apiDecksGet(name: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
|
if (name === null || name === undefined) {
|
|
throw new Error('Required parameter name was null or undefined when calling apiDecksGet.');
|
|
}
|
|
|
|
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
|
<any>name, 'name');
|
|
|
|
let localVarHeaders = this.defaultHeaders;
|
|
|
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
|
'application/json'
|
|
]);
|
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
|
}
|
|
|
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
|
|
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
|
|
|
|
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
|
if (localVarHttpHeaderAcceptSelected) {
|
|
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
|
responseType_ = 'text';
|
|
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
|
responseType_ = 'json';
|
|
} else {
|
|
responseType_ = 'blob';
|
|
}
|
|
}
|
|
|
|
let localVarPath = `/api/decks`;
|
|
return this.httpClient.request<Deck>('get', `${this.configuration.basePath}${localVarPath}`,
|
|
{
|
|
context: localVarHttpContext,
|
|
params: localVarQueryParameters,
|
|
responseType: <any>responseType_,
|
|
withCredentials: this.configuration.withCredentials,
|
|
headers: localVarHeaders,
|
|
observe: observe,
|
|
transferCache: localVarTransferCache,
|
|
reportProgress: reportProgress
|
|
}
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Create Deck
|
|
* @param deck
|
|
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
|
* @param reportProgress flag to report request and response progress.
|
|
*/
|
|
public apiDecksPost(deck: Deck, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<string>;
|
|
public apiDecksPost(deck: Deck, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<string>>;
|
|
public apiDecksPost(deck: Deck, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<string>>;
|
|
public apiDecksPost(deck: Deck, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
|
if (deck === null || deck === undefined) {
|
|
throw new Error('Required parameter deck was null or undefined when calling apiDecksPost.');
|
|
}
|
|
|
|
let localVarHeaders = this.defaultHeaders;
|
|
|
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
|
'application/json'
|
|
]);
|
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
|
}
|
|
|
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
|
|
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
|
|
|
|
|
// to determine the Content-Type header
|
|
const consumes: string[] = [
|
|
'application/json'
|
|
];
|
|
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
|
|
if (httpContentTypeSelected !== undefined) {
|
|
localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected);
|
|
}
|
|
|
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
|
if (localVarHttpHeaderAcceptSelected) {
|
|
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
|
responseType_ = 'text';
|
|
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
|
responseType_ = 'json';
|
|
} else {
|
|
responseType_ = 'blob';
|
|
}
|
|
}
|
|
|
|
let localVarPath = `/api/decks`;
|
|
return this.httpClient.request<string>('post', `${this.configuration.basePath}${localVarPath}`,
|
|
{
|
|
context: localVarHttpContext,
|
|
body: deck,
|
|
responseType: <any>responseType_,
|
|
withCredentials: this.configuration.withCredentials,
|
|
headers: localVarHeaders,
|
|
observe: observe,
|
|
transferCache: localVarTransferCache,
|
|
reportProgress: reportProgress
|
|
}
|
|
);
|
|
}
|
|
|
|
}
|