Compare commits

..

2 Commits

Author SHA1 Message Date
rak
acd910e013 Init OpenAPI 2025-06-22 14:30:54 +02:00
rak
2545c0840d Init OpenAPI 2025-06-21 16:55:53 +02:00
45 changed files with 4779 additions and 14 deletions

23
openapitools.json Normal file
View File

@@ -0,0 +1,23 @@
{
"$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json",
"spaces": 2,
"generator-cli": {
"version": "7.13.0",
"generators": {
"v2.0": {
"generatorName": "typescript-axios",
"inputSpec": "http://localhost:8080/q/openapi",
"output": "#{cwd}/src/api//#{name}",
"apiNameSuffix": "Service",
"additionalProperties": {
"apiPackage": "service",
"modelPackage": "model",
"withSeparateModelsAndApi": true,
"npmName": "restClient",
"supportsES6": "true",
"withInterfaces": true
}
}
}
}
}

2036
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -6,11 +6,13 @@
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",
"build": "vue-tsc -b && vite build", "build": "vue-tsc -b && vite build",
"preview": "vite preview" "preview": "vite preview",
"openapi-generator": "openapi-generator-cli generate -i http://localhost:8080/q/openapi --api-name-suffix 'Service' -g typescript-axios -o src/api/openpi -c openapi-generator-config.json"
}, },
"dependencies": { "dependencies": {
"@primeuix/themes": "^1.0.3", "@primeuix/themes": "^1.0.3",
"@tailwindcss/vite": "^4.1.5", "@tailwindcss/vite": "^4.1.5",
"axios": "^1.10.0",
"primevue": "^4.3.3", "primevue": "^4.3.3",
"tailwindcss": "^4.1.5", "tailwindcss": "^4.1.5",
"tailwindcss-primeui": "^0.6.1", "tailwindcss-primeui": "^0.6.1",
@@ -18,6 +20,7 @@
"vue-router": "^4.5.1" "vue-router": "^4.5.1"
}, },
"devDependencies": { "devDependencies": {
"@openapitools/openapi-generator-cli": "^2.20.2",
"@vitejs/plugin-vue": "^5.2.2", "@vitejs/plugin-vue": "^5.2.2",
"@vue/tsconfig": "^0.7.0", "@vue/tsconfig": "^0.7.0",
"typescript": "~5.7.2", "typescript": "~5.7.2",

View File

@@ -13,7 +13,7 @@
</div> </div>
</div> </div>
<main> <main class="w-dvw">
<RouterView/> <RouterView/>
</main> </main>
</template> </template>

4
src/api/openapi/.gitignore vendored Normal file
View File

@@ -0,0 +1,4 @@
wwwroot/*.js
node_modules
typings
dist

View File

@@ -0,0 +1 @@
# empty npmignore to ensure all required files (e.g., in the dist folder) are published by npm

View File

@@ -0,0 +1,23 @@
# OpenAPI Generator Ignore
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.
# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
#ApiClient.cs
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md

View File

@@ -0,0 +1,36 @@
.gitignore
.npmignore
.openapi-generator-ignore
README.md
api.ts
base.ts
common.ts
configuration.ts
docs/Card.md
docs/CardPrint.md
docs/CardService.md
docs/CardType.md
docs/Deck.md
docs/DeckService.md
docs/NewCard.md
docs/PageDeck.md
docs/Region.md
docs/RegionalSet.md
docs/SetPrefix.md
git_push.sh
index.ts
model/card-print.ts
model/card-type.ts
model/card.ts
model/deck.ts
model/index.ts
model/new-card.ts
model/page-deck.ts
model/region.ts
model/regional-set.ts
model/set-prefix.ts
package.json
service/card-service.ts
service/deck-service.ts
tsconfig.esm.json
tsconfig.json

View File

@@ -0,0 +1 @@
7.13.0

81
src/api/openapi/README.md Normal file
View File

@@ -0,0 +1,81 @@
## restClient@0.0.1
This generator creates TypeScript/JavaScript client that utilizes [axios](https://github.com/axios/axios). The generated Node module can be used in the following environments:
Environment
* Node.js
* Webpack
* Browserify
Language level
* ES5 - you must have a Promises/A+ library installed
* ES6
Module system
* CommonJS
* ES6 module system
It can be used in both TypeScript and JavaScript. In TypeScript, the definition will be automatically resolved via `package.json`. ([Reference](https://www.typescriptlang.org/docs/handbook/declaration-files/consumption.html))
### Building
To build and compile the typescript sources to javascript use:
```
npm install
npm run build
```
### Publishing
First build the package then run `npm publish`
### Consuming
navigate to the folder of your consuming project and run one of the following commands.
_published:_
```
npm install restClient@0.0.1 --save
```
_unPublished (not recommended):_
```
npm install PATH_TO_GENERATED_PACKAGE --save
```
### Documentation for API Endpoints
All URIs are relative to *http://localhost*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*CardService* | [**apiCardsIdNewPut**](docs/CardService.md#apicardsidnewput) | **PUT** /api/cards/{id}/new | Test
*CardService* | [**getCardById**](docs/CardService.md#getcardbyid) | **GET** /api/cards/{id} | Get a singular Card by its ID
*CardService* | [**getCardImageById**](docs/CardService.md#getcardimagebyid) | **GET** /api/cards/{id}/image | Get the image of a Card by its ID
*CardService* | [**getCards**](docs/CardService.md#getcards) | **GET** /api/cards | Get a page of Cards with optional name query parameter
*DeckService* | [**addCardToDeck**](docs/DeckService.md#addcardtodeck) | **POST** /api/decks/{deckName}/{cardId} | Add a Card by its ID to a Deck by its name
*DeckService* | [**createDeck**](docs/DeckService.md#createdeck) | **POST** /api/decks | Create a Deck with a given name
*DeckService* | [**getDeckByName**](docs/DeckService.md#getdeckbyname) | **GET** /api/decks/{name} | Get a singular Deck by its name
*DeckService* | [**getDecks**](docs/DeckService.md#getdecks) | **GET** /api/decks | Get a page of Decks with optional name query parameter
### Documentation For Models
- [Card](docs/Card.md)
- [CardPrint](docs/CardPrint.md)
- [CardType](docs/CardType.md)
- [Deck](docs/Deck.md)
- [NewCard](docs/NewCard.md)
- [PageDeck](docs/PageDeck.md)
- [Region](docs/Region.md)
- [RegionalSet](docs/RegionalSet.md)
- [SetPrefix](docs/SetPrefix.md)
<a id="documentation-for-authorization"></a>
## Documentation For Authorization
Endpoints do not require authorization.

19
src/api/openapi/api.ts Normal file
View File

@@ -0,0 +1,19 @@
/* tslint:disable */
/* eslint-disable */
/**
* dex API
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 0.0.1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
export * from './service/card-service';
export * from './service/deck-service';

86
src/api/openapi/base.ts Normal file
View File

@@ -0,0 +1,86 @@
/* tslint:disable */
/* eslint-disable */
/**
* dex API
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 0.0.1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import type { Configuration } from './configuration';
// Some imports not used depending on template conditions
// @ts-ignore
import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios';
import globalAxios from 'axios';
export const BASE_PATH = "http://localhost".replace(/\/+$/, "");
/**
*
* @export
*/
export const COLLECTION_FORMATS = {
csv: ",",
ssv: " ",
tsv: "\t",
pipes: "|",
};
/**
*
* @export
* @interface RequestArgs
*/
export interface RequestArgs {
url: string;
options: RawAxiosRequestConfig;
}
/**
*
* @export
* @class BaseAPI
*/
export class BaseAPI {
protected configuration: Configuration | undefined;
constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) {
if (configuration) {
this.configuration = configuration;
this.basePath = configuration.basePath ?? basePath;
}
}
};
/**
*
* @export
* @class RequiredError
* @extends {Error}
*/
export class RequiredError extends Error {
constructor(public field: string, msg?: string) {
super(msg);
this.name = "RequiredError"
}
}
interface ServerMap {
[key: string]: {
url: string,
description: string,
}[];
}
/**
*
* @export
*/
export const operationServerMap: ServerMap = {
}

150
src/api/openapi/common.ts Normal file
View File

@@ -0,0 +1,150 @@
/* tslint:disable */
/* eslint-disable */
/**
* dex API
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 0.0.1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import type { Configuration } from "./configuration";
import type { RequestArgs } from "./base";
import type { AxiosInstance, AxiosResponse } from 'axios';
import { RequiredError } from "./base";
/**
*
* @export
*/
export const DUMMY_BASE_URL = 'https://example.com'
/**
*
* @throws {RequiredError}
* @export
*/
export const assertParamExists = function (functionName: string, paramName: string, paramValue: unknown) {
if (paramValue === null || paramValue === undefined) {
throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`);
}
}
/**
*
* @export
*/
export const setApiKeyToObject = async function (object: any, keyParamName: string, configuration?: Configuration) {
if (configuration && configuration.apiKey) {
const localVarApiKeyValue = typeof configuration.apiKey === 'function'
? await configuration.apiKey(keyParamName)
: await configuration.apiKey;
object[keyParamName] = localVarApiKeyValue;
}
}
/**
*
* @export
*/
export const setBasicAuthToObject = function (object: any, configuration?: Configuration) {
if (configuration && (configuration.username || configuration.password)) {
object["auth"] = { username: configuration.username, password: configuration.password };
}
}
/**
*
* @export
*/
export const setBearerAuthToObject = async function (object: any, configuration?: Configuration) {
if (configuration && configuration.accessToken) {
const accessToken = typeof configuration.accessToken === 'function'
? await configuration.accessToken()
: await configuration.accessToken;
object["Authorization"] = "Bearer " + accessToken;
}
}
/**
*
* @export
*/
export const setOAuthToObject = async function (object: any, name: string, scopes: string[], configuration?: Configuration) {
if (configuration && configuration.accessToken) {
const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
? await configuration.accessToken(name, scopes)
: await configuration.accessToken;
object["Authorization"] = "Bearer " + localVarAccessTokenValue;
}
}
function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: any, key: string = ""): void {
if (parameter == null) return;
if (typeof parameter === "object") {
if (Array.isArray(parameter)) {
(parameter as any[]).forEach(item => setFlattenedQueryParams(urlSearchParams, item, key));
}
else {
Object.keys(parameter).forEach(currentKey =>
setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== '' ? '.' : ''}${currentKey}`)
);
}
}
else {
if (urlSearchParams.has(key)) {
urlSearchParams.append(key, parameter);
}
else {
urlSearchParams.set(key, parameter);
}
}
}
/**
*
* @export
*/
export const setSearchParams = function (url: URL, ...objects: any[]) {
const searchParams = new URLSearchParams(url.search);
setFlattenedQueryParams(searchParams, objects);
url.search = searchParams.toString();
}
/**
*
* @export
*/
export const serializeDataIfNeeded = function (value: any, requestOptions: any, configuration?: Configuration) {
const nonString = typeof value !== 'string';
const needsSerialization = nonString && configuration && configuration.isJsonMime
? configuration.isJsonMime(requestOptions.headers['Content-Type'])
: nonString;
return needsSerialization
? JSON.stringify(value !== undefined ? value : {})
: (value || "");
}
/**
*
* @export
*/
export const toPathString = function (url: URL) {
return url.pathname + url.search + url.hash
}
/**
*
* @export
*/
export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) {
return <T = unknown, R = AxiosResponse<T>>(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...axiosArgs.options, url: (axios.defaults.baseURL ? '' : configuration?.basePath ?? basePath) + axiosArgs.url};
return axios.request<T, R>(axiosRequestArgs);
};
}

View File

@@ -0,0 +1,115 @@
/* tslint:disable */
/* eslint-disable */
/**
* dex API
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 0.0.1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
export interface ConfigurationParameters {
apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
username?: string;
password?: string;
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
basePath?: string;
serverIndex?: number;
baseOptions?: any;
formDataCtor?: new () => any;
}
export class Configuration {
/**
* parameter for apiKey security
* @param name security name
* @memberof Configuration
*/
apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
/**
* parameter for basic security
*
* @type {string}
* @memberof Configuration
*/
username?: string;
/**
* parameter for basic security
*
* @type {string}
* @memberof Configuration
*/
password?: string;
/**
* parameter for oauth2 security
* @param name security name
* @param scopes oauth2 scope
* @memberof Configuration
*/
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
/**
* override base path
*
* @type {string}
* @memberof Configuration
*/
basePath?: string;
/**
* override server index
*
* @type {number}
* @memberof Configuration
*/
serverIndex?: number;
/**
* base options for axios calls
*
* @type {any}
* @memberof Configuration
*/
baseOptions?: any;
/**
* The FormData constructor that will be used to create multipart form data
* requests. You can inject this here so that execution environments that
* do not support the FormData class can still run the generated client.
*
* @type {new () => FormData}
*/
formDataCtor?: new () => any;
constructor(param: ConfigurationParameters = {}) {
this.apiKey = param.apiKey;
this.username = param.username;
this.password = param.password;
this.accessToken = param.accessToken;
this.basePath = param.basePath;
this.serverIndex = param.serverIndex;
this.baseOptions = {
...param.baseOptions,
headers: {
...param.baseOptions?.headers,
},
};
this.formDataCtor = param.formDataCtor;
}
/**
* Check if the given MIME is a JSON MIME.
* JSON MIME examples:
* application/json
* application/json; charset=UTF8
* APPLICATION/JSON
* application/vnd.company+json
* @param mime - MIME (Multipurpose Internet Mail Extensions)
* @return True if the given MIME is JSON, false otherwise.
*/
public isJsonMime(mime: string): boolean {
const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
}
}

View File

@@ -0,0 +1,46 @@
# Card
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **number** | | [optional] [default to undefined]
**description** | **string** | | [default to undefined]
**pendulumDescription** | **string** | | [optional] [default to undefined]
**defense** | **number** | | [optional] [default to undefined]
**attack** | **number** | | [optional] [default to undefined]
**health** | **number** | | [optional] [default to undefined]
**level** | **number** | | [optional] [default to undefined]
**linkValue** | **number** | | [optional] [default to undefined]
**name** | **string** | | [default to undefined]
**type** | **string** | | [default to undefined]
**frameType** | **string** | | [default to undefined]
**archetype** | **string** | | [optional] [default to undefined]
**race** | **string** | | [optional] [default to undefined]
**attribute** | **string** | | [optional] [default to undefined]
## Example
```typescript
import { Card } from 'restClient';
const instance: Card = {
id,
description,
pendulumDescription,
defense,
attack,
health,
level,
linkValue,
name,
type,
frameType,
archetype,
race,
attribute,
};
```
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -0,0 +1,26 @@
# CardPrint
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **number** | | [optional] [default to undefined]
**regionalSet** | [**RegionalSet**](RegionalSet.md) | | [default to undefined]
**card** | [**NewCard**](NewCard.md) | | [default to undefined]
**imageApiPath** | **string** | | [default to undefined]
## Example
```typescript
import { CardPrint } from 'restClient';
const instance: CardPrint = {
id,
regionalSet,
card,
imageApiPath,
};
```
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -0,0 +1,219 @@
# CardService
All URIs are relative to *http://localhost*
|Method | HTTP request | Description|
|------------- | ------------- | -------------|
|[**apiCardsIdNewPut**](#apicardsidnewput) | **PUT** /api/cards/{id}/new | Test|
|[**getCardById**](#getcardbyid) | **GET** /api/cards/{id} | Get a singular Card by its ID|
|[**getCardImageById**](#getcardimagebyid) | **GET** /api/cards/{id}/image | Get the image of a Card by its ID|
|[**getCards**](#getcards) | **GET** /api/cards | Get a page of Cards with optional name query parameter|
# **apiCardsIdNewPut**
> apiCardsIdNewPut()
### Example
```typescript
import {
CardService,
Configuration
} from 'restClient';
const configuration = new Configuration();
const apiInstance = new CardService(configuration);
let id: number; // (default to undefined)
const { status, data } = await apiInstance.apiCardsIdNewPut(
id
);
```
### Parameters
|Name | Type | Description | Notes|
|------------- | ------------- | ------------- | -------------|
| **id** | [**number**] | | defaults to undefined|
### Return type
void (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**204** | No Content | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **getCardById**
> NewCard getCardById()
### Example
```typescript
import {
CardService,
Configuration
} from 'restClient';
const configuration = new Configuration();
const apiInstance = new CardService(configuration);
let id: number; // (default to undefined)
const { status, data } = await apiInstance.getCardById(
id
);
```
### Parameters
|Name | Type | Description | Notes|
|------------- | ------------- | ------------- | -------------|
| **id** | [**number**] | | defaults to undefined|
### Return type
**NewCard**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**200** | Card retrieved | - |
|**404** | Card with ID cannot be found | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **getCardImageById**
> File getCardImageById()
### Example
```typescript
import {
CardService,
Configuration
} from 'restClient';
const configuration = new Configuration();
const apiInstance = new CardService(configuration);
let id: number; // (default to undefined)
const { status, data } = await apiInstance.getCardImageById(
id
);
```
### Parameters
|Name | Type | Description | Notes|
|------------- | ------------- | ------------- | -------------|
| **id** | [**number**] | | defaults to undefined|
### Return type
**File**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/octet-stream
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**200** | Card image retrieved | - |
|**404** | Card image for ID cannot be found | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **getCards**
> Array<Card> getCards()
### Example
```typescript
import {
CardService,
Configuration
} from 'restClient';
const configuration = new Configuration();
const apiInstance = new CardService(configuration);
let name: string; // (optional) (default to undefined)
let page: number; // (optional) (default to undefined)
let pageSize: number; // (optional) (default to undefined)
const { status, data } = await apiInstance.getCards(
name,
page,
pageSize
);
```
### Parameters
|Name | Type | Description | Notes|
|------------- | ------------- | ------------- | -------------|
| **name** | [**string**] | | (optional) defaults to undefined|
| **page** | [**number**] | | (optional) defaults to undefined|
| **pageSize** | [**number**] | | (optional) defaults to undefined|
### Return type
**Array<Card>**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**200** | Page for the given query | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

View File

@@ -0,0 +1,14 @@
# CardType
## Enum
* `Monster` (value: `'MONSTER'`)
* `Spell` (value: `'SPELL'`)
* `Trap` (value: `'TRAP'`)
* `Unknown` (value: `'UNKNOWN'`)
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -0,0 +1,24 @@
# Deck
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **number** | | [optional] [default to undefined]
**name** | **string** | | [default to undefined]
**cards** | **{ [key: string]: number; }** | | [default to undefined]
## Example
```typescript
import { Deck } from 'restClient';
const instance: Deck = {
id,
name,
cards,
};
```
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -0,0 +1,224 @@
# DeckService
All URIs are relative to *http://localhost*
|Method | HTTP request | Description|
|------------- | ------------- | -------------|
|[**addCardToDeck**](#addcardtodeck) | **POST** /api/decks/{deckName}/{cardId} | Add a Card by its ID to a Deck by its name|
|[**createDeck**](#createdeck) | **POST** /api/decks | Create a Deck with a given name|
|[**getDeckByName**](#getdeckbyname) | **GET** /api/decks/{name} | Get a singular Deck by its name|
|[**getDecks**](#getdecks) | **GET** /api/decks | Get a page of Decks with optional name query parameter|
# **addCardToDeck**
> addCardToDeck()
### Example
```typescript
import {
DeckService,
Configuration
} from 'restClient';
const configuration = new Configuration();
const apiInstance = new DeckService(configuration);
let cardId: number; // (default to undefined)
let deckName: string; // (default to undefined)
const { status, data } = await apiInstance.addCardToDeck(
cardId,
deckName
);
```
### Parameters
|Name | Type | Description | Notes|
|------------- | ------------- | ------------- | -------------|
| **cardId** | [**number**] | | defaults to undefined|
| **deckName** | [**string**] | | defaults to undefined|
### Return type
void (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**201** | Card successfully added to Deck | - |
|**404** | Deck with name cannot be found | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **createDeck**
> createDeck(deck)
### Example
```typescript
import {
DeckService,
Configuration,
Deck
} from 'restClient';
const configuration = new Configuration();
const apiInstance = new DeckService(configuration);
let deck: Deck; //
const { status, data } = await apiInstance.createDeck(
deck
);
```
### Parameters
|Name | Type | Description | Notes|
|------------- | ------------- | ------------- | -------------|
| **deck** | **Deck**| | |
### Return type
void (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: Not defined
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**401** | Deck successfully created | - |
|**409** | Card with name already exists | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **getDeckByName**
> Deck getDeckByName()
### Example
```typescript
import {
DeckService,
Configuration
} from 'restClient';
const configuration = new Configuration();
const apiInstance = new DeckService(configuration);
let name: string; // (default to undefined)
const { status, data } = await apiInstance.getDeckByName(
name
);
```
### Parameters
|Name | Type | Description | Notes|
|------------- | ------------- | ------------- | -------------|
| **name** | [**string**] | | defaults to undefined|
### Return type
**Deck**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**200** | Deck retrieved | - |
|**404** | Deck with name cannot be found | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **getDecks**
> PageDeck getDecks()
### Example
```typescript
import {
DeckService,
Configuration
} from 'restClient';
const configuration = new Configuration();
const apiInstance = new DeckService(configuration);
let name: string; // (optional) (default to undefined)
let page: number; // (optional) (default to undefined)
let pageSize: number; // (optional) (default to undefined)
const { status, data } = await apiInstance.getDecks(
name,
page,
pageSize
);
```
### Parameters
|Name | Type | Description | Notes|
|------------- | ------------- | ------------- | -------------|
| **name** | [**string**] | | (optional) defaults to undefined|
| **page** | [**number**] | | (optional) defaults to undefined|
| **pageSize** | [**number**] | | (optional) defaults to undefined|
### Return type
**PageDeck**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**200** | Page of Decks for given query | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

View File

@@ -0,0 +1,28 @@
# NewCard
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **number** | | [optional] [default to undefined]
**cardType** | [**CardType**](CardType.md) | | [default to undefined]
**description** | **string** | | [default to undefined]
**name** | **string** | | [default to undefined]
**cardPrints** | [**Set&lt;CardPrint&gt;**](CardPrint.md) | | [default to undefined]
## Example
```typescript
import { NewCard } from 'restClient';
const instance: NewCard = {
id,
cardType,
description,
name,
cardPrints,
};
```
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -0,0 +1,26 @@
# PageDeck
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**content** | [**Array&lt;Deck&gt;**](Deck.md) | | [default to undefined]
**page** | **number** | | [optional] [default to undefined]
**pageSize** | **number** | | [optional] [default to undefined]
**totalPages** | **number** | | [optional] [default to undefined]
## Example
```typescript
import { PageDeck } from 'restClient';
const instance: PageDeck = {
content,
page,
pageSize,
totalPages,
};
```
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -0,0 +1,24 @@
# Region
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **number** | | [default to undefined]
**name** | **string** | | [default to undefined]
**regionalSets** | [**Set&lt;RegionalSet&gt;**](RegionalSet.md) | | [default to undefined]
## Example
```typescript
import { Region } from 'restClient';
const instance: Region = {
id,
name,
regionalSets,
};
```
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -0,0 +1,26 @@
# RegionalSet
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **number** | | [default to undefined]
**prefix** | [**SetPrefix**](SetPrefix.md) | | [default to undefined]
**region** | [**Region**](Region.md) | | [default to undefined]
**cardPrints** | [**Set&lt;CardPrint&gt;**](CardPrint.md) | | [default to undefined]
## Example
```typescript
import { RegionalSet } from 'restClient';
const instance: RegionalSet = {
id,
prefix,
region,
cardPrints,
};
```
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -0,0 +1,24 @@
# SetPrefix
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **number** | | [default to undefined]
**name** | **string** | | [default to undefined]
**regionalSets** | [**Set&lt;RegionalSet&gt;**](RegionalSet.md) | | [default to undefined]
## Example
```typescript
import { SetPrefix } from 'restClient';
const instance: SetPrefix = {
id,
name,
regionalSets,
};
```
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -0,0 +1,57 @@
#!/bin/sh
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
#
# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com"
git_user_id=$1
git_repo_id=$2
release_note=$3
git_host=$4
if [ "$git_host" = "" ]; then
git_host="github.com"
echo "[INFO] No command line input provided. Set \$git_host to $git_host"
fi
if [ "$git_user_id" = "" ]; then
git_user_id="GIT_USER_ID"
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
fi
if [ "$git_repo_id" = "" ]; then
git_repo_id="GIT_REPO_ID"
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
fi
if [ "$release_note" = "" ]; then
release_note="Minor update"
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
fi
# Initialize the local directory as a Git repository
git init
# Adds the files in the local repository and stages them for commit.
git add .
# Commits the tracked changes and prepares them to be pushed to a remote repository.
git commit -m "$release_note"
# Sets the new remote
git_remote=$(git remote)
if [ "$git_remote" = "" ]; then # git remote not defined
if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
else
git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git
fi
fi
git pull origin master
# Pushes (Forces) the changes in the local repository up to the remote repository
echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
git push origin master 2>&1 | grep -v 'To https'

18
src/api/openapi/index.ts Normal file
View File

@@ -0,0 +1,18 @@
/* tslint:disable */
/* eslint-disable */
/**
* dex API
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 0.0.1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
export * from "./api";
export * from "./configuration";
export * from "./model";

View File

@@ -0,0 +1,54 @@
/* tslint:disable */
/* eslint-disable */
/**
* dex API
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 0.0.1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
// May contain unused imports in some cases
// @ts-ignore
import type { NewCard } from './new-card';
// May contain unused imports in some cases
// @ts-ignore
import type { RegionalSet } from './regional-set';
/**
*
* @export
* @interface CardPrint
*/
export interface CardPrint {
/**
*
* @type {number}
* @memberof CardPrint
*/
'id'?: number;
/**
*
* @type {RegionalSet}
* @memberof CardPrint
*/
'regionalSet': RegionalSet;
/**
*
* @type {NewCard}
* @memberof CardPrint
*/
'card': NewCard;
/**
*
* @type {string}
* @memberof CardPrint
*/
'imageApiPath': string;
}

View File

@@ -0,0 +1,33 @@
/* tslint:disable */
/* eslint-disable */
/**
* dex API
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 0.0.1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/**
*
* @export
* @enum {string}
*/
export const CardType = {
Monster: 'MONSTER',
Spell: 'SPELL',
Trap: 'TRAP',
Unknown: 'UNKNOWN'
} as const;
export type CardType = typeof CardType[keyof typeof CardType];

View File

@@ -0,0 +1,108 @@
/* tslint:disable */
/* eslint-disable */
/**
* dex API
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 0.0.1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/**
*
* @export
* @interface Card
*/
export interface Card {
/**
*
* @type {number}
* @memberof Card
*/
'id'?: number;
/**
*
* @type {string}
* @memberof Card
*/
'description': string;
/**
*
* @type {string}
* @memberof Card
*/
'pendulumDescription'?: string | null;
/**
*
* @type {number}
* @memberof Card
*/
'defense'?: number | null;
/**
*
* @type {number}
* @memberof Card
*/
'attack'?: number | null;
/**
*
* @type {number}
* @memberof Card
*/
'health'?: number | null;
/**
*
* @type {number}
* @memberof Card
*/
'level'?: number | null;
/**
*
* @type {number}
* @memberof Card
*/
'linkValue'?: number | null;
/**
*
* @type {string}
* @memberof Card
*/
'name': string;
/**
*
* @type {string}
* @memberof Card
*/
'type': string;
/**
*
* @type {string}
* @memberof Card
*/
'frameType': string;
/**
*
* @type {string}
* @memberof Card
*/
'archetype'?: string | null;
/**
*
* @type {string}
* @memberof Card
*/
'race'?: string | null;
/**
*
* @type {string}
* @memberof Card
*/
'attribute'?: string | null;
}

View File

@@ -0,0 +1,42 @@
/* tslint:disable */
/* eslint-disable */
/**
* dex API
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 0.0.1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/**
*
* @export
* @interface Deck
*/
export interface Deck {
/**
*
* @type {number}
* @memberof Deck
*/
'id'?: number;
/**
*
* @type {string}
* @memberof Deck
*/
'name': string;
/**
*
* @type {{ [key: string]: number; }}
* @memberof Deck
*/
'cards': { [key: string]: number; };
}

View File

@@ -0,0 +1,9 @@
export * from './card';
export * from './card-print';
export * from './card-type';
export * from './deck';
export * from './new-card';
export * from './page-deck';
export * from './region';
export * from './regional-set';
export * from './set-prefix';

View File

@@ -0,0 +1,62 @@
/* tslint:disable */
/* eslint-disable */
/**
* dex API
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 0.0.1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
// May contain unused imports in some cases
// @ts-ignore
import type { CardPrint } from './card-print';
// May contain unused imports in some cases
// @ts-ignore
import type { CardType } from './card-type';
/**
*
* @export
* @interface NewCard
*/
export interface NewCard {
/**
*
* @type {number}
* @memberof NewCard
*/
'id'?: number;
/**
*
* @type {CardType}
* @memberof NewCard
*/
'cardType': CardType;
/**
*
* @type {string}
* @memberof NewCard
*/
'description': string;
/**
*
* @type {string}
* @memberof NewCard
*/
'name': string;
/**
*
* @type {Set<CardPrint>}
* @memberof NewCard
*/
'cardPrints': Set<CardPrint>;
}

View File

@@ -0,0 +1,51 @@
/* tslint:disable */
/* eslint-disable */
/**
* dex API
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 0.0.1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
// May contain unused imports in some cases
// @ts-ignore
import type { Deck } from './deck';
/**
*
* @export
* @interface PageDeck
*/
export interface PageDeck {
/**
*
* @type {Array<Deck>}
* @memberof PageDeck
*/
'content': Array<Deck>;
/**
*
* @type {number}
* @memberof PageDeck
*/
'page'?: number;
/**
*
* @type {number}
* @memberof PageDeck
*/
'pageSize'?: number;
/**
*
* @type {number}
* @memberof PageDeck
*/
'totalPages'?: number;
}

View File

@@ -0,0 +1,45 @@
/* tslint:disable */
/* eslint-disable */
/**
* dex API
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 0.0.1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
// May contain unused imports in some cases
// @ts-ignore
import type { RegionalSet } from './regional-set';
/**
*
* @export
* @interface Region
*/
export interface Region {
/**
*
* @type {number}
* @memberof Region
*/
'id': number;
/**
*
* @type {string}
* @memberof Region
*/
'name': string;
/**
*
* @type {Set<RegionalSet>}
* @memberof Region
*/
'regionalSets': Set<RegionalSet>;
}

View File

@@ -0,0 +1,57 @@
/* tslint:disable */
/* eslint-disable */
/**
* dex API
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 0.0.1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
// May contain unused imports in some cases
// @ts-ignore
import type { CardPrint } from './card-print';
// May contain unused imports in some cases
// @ts-ignore
import type { Region } from './region';
// May contain unused imports in some cases
// @ts-ignore
import type { SetPrefix } from './set-prefix';
/**
*
* @export
* @interface RegionalSet
*/
export interface RegionalSet {
/**
*
* @type {number}
* @memberof RegionalSet
*/
'id': number;
/**
*
* @type {SetPrefix}
* @memberof RegionalSet
*/
'prefix': SetPrefix;
/**
*
* @type {Region}
* @memberof RegionalSet
*/
'region': Region;
/**
*
* @type {Set<CardPrint>}
* @memberof RegionalSet
*/
'cardPrints': Set<CardPrint>;
}

View File

@@ -0,0 +1,45 @@
/* tslint:disable */
/* eslint-disable */
/**
* dex API
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 0.0.1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
// May contain unused imports in some cases
// @ts-ignore
import type { RegionalSet } from './regional-set';
/**
*
* @export
* @interface SetPrefix
*/
export interface SetPrefix {
/**
*
* @type {number}
* @memberof SetPrefix
*/
'id': number;
/**
*
* @type {string}
* @memberof SetPrefix
*/
'name': string;
/**
*
* @type {Set<RegionalSet>}
* @memberof SetPrefix
*/
'regionalSets': Set<RegionalSet>;
}

View File

@@ -0,0 +1,33 @@
{
"name": "restClient",
"version": "0.0.1",
"description": "OpenAPI client for restClient",
"author": "OpenAPI-Generator Contributors",
"repository": {
"type": "git",
"url": "https://github.com/GIT_USER_ID/GIT_REPO_ID.git"
},
"keywords": [
"axios",
"typescript",
"openapi-client",
"openapi-generator",
"restClient"
],
"license": "Unlicense",
"main": "./dist/index.js",
"typings": "./dist/index.d.ts",
"module": "./dist/esm/index.js",
"sideEffects": false,
"scripts": {
"build": "tsc && tsc -p tsconfig.esm.json",
"prepare": "npm run build"
},
"dependencies": {
"axios": "^1.6.1"
},
"devDependencies": {
"@types/node": "12.11.5 - 12.20.42",
"typescript": "^4.0 || ^5.0"
}
}

View File

@@ -0,0 +1,407 @@
/* tslint:disable */
/* eslint-disable */
/**
* dex API
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 0.0.1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import type { Configuration } from '../configuration';
import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios';
import globalAxios from 'axios';
// Some imports not used depending on template conditions
// @ts-ignore
import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../common';
// @ts-ignore
import { BASE_PATH, COLLECTION_FORMATS, type RequestArgs, BaseAPI, RequiredError, operationServerMap } from '../base';
// @ts-ignore
import type { Card } from '../model';
// @ts-ignore
import type { NewCard } from '../model';
/**
* CardService - axios parameter creator
* @export
*/
export const CardServiceAxiosParamCreator = function (configuration?: Configuration) {
return {
/**
*
* @summary Test
* @param {number} id
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
apiCardsIdNewPut: async (id: number, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
// verify required parameter 'id' is not null or undefined
assertParamExists('apiCardsIdNewPut', 'id', id)
const localVarPath = `/api/cards/{id}/new`
.replace(`{${"id"}}`, encodeURIComponent(String(id)));
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'PUT', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
*
* @summary Get a singular Card by its ID
* @param {number} id
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getCardById: async (id: number, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
// verify required parameter 'id' is not null or undefined
assertParamExists('getCardById', 'id', id)
const localVarPath = `/api/cards/{id}`
.replace(`{${"id"}}`, encodeURIComponent(String(id)));
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
*
* @summary Get the image of a Card by its ID
* @param {number} id
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getCardImageById: async (id: number, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
// verify required parameter 'id' is not null or undefined
assertParamExists('getCardImageById', 'id', id)
const localVarPath = `/api/cards/{id}/image`
.replace(`{${"id"}}`, encodeURIComponent(String(id)));
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
*
* @summary Get a page of Cards with optional name query parameter
* @param {string | null} [name]
* @param {number} [page]
* @param {number} [pageSize]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getCards: async (name?: string | null, page?: number, pageSize?: number, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
const localVarPath = `/api/cards`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
if (name !== undefined) {
localVarQueryParameter['name'] = name;
}
if (page !== undefined) {
localVarQueryParameter['page'] = page;
}
if (pageSize !== undefined) {
localVarQueryParameter['pageSize'] = pageSize;
}
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
}
};
/**
* CardService - functional programming interface
* @export
*/
export const CardServiceFp = function(configuration?: Configuration) {
const localVarAxiosParamCreator = CardServiceAxiosParamCreator(configuration)
return {
/**
*
* @summary Test
* @param {number} id
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async apiCardsIdNewPut(id: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.apiCardsIdNewPut(id, options);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath = operationServerMap['CardService.apiCardsIdNewPut']?.[localVarOperationServerIndex]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
},
/**
*
* @summary Get a singular Card by its ID
* @param {number} id
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async getCardById(id: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<NewCard>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.getCardById(id, options);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath = operationServerMap['CardService.getCardById']?.[localVarOperationServerIndex]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
},
/**
*
* @summary Get the image of a Card by its ID
* @param {number} id
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async getCardImageById(id: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<File>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.getCardImageById(id, options);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath = operationServerMap['CardService.getCardImageById']?.[localVarOperationServerIndex]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
},
/**
*
* @summary Get a page of Cards with optional name query parameter
* @param {string | null} [name]
* @param {number} [page]
* @param {number} [pageSize]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async getCards(name?: string | null, page?: number, pageSize?: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Array<Card>>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.getCards(name, page, pageSize, options);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath = operationServerMap['CardService.getCards']?.[localVarOperationServerIndex]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
},
}
};
/**
* CardService - factory interface
* @export
*/
export const CardServiceFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
const localVarFp = CardServiceFp(configuration)
return {
/**
*
* @summary Test
* @param {number} id
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
apiCardsIdNewPut(id: number, options?: RawAxiosRequestConfig): AxiosPromise<void> {
return localVarFp.apiCardsIdNewPut(id, options).then((request) => request(axios, basePath));
},
/**
*
* @summary Get a singular Card by its ID
* @param {number} id
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getCardById(id: number, options?: RawAxiosRequestConfig): AxiosPromise<NewCard> {
return localVarFp.getCardById(id, options).then((request) => request(axios, basePath));
},
/**
*
* @summary Get the image of a Card by its ID
* @param {number} id
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getCardImageById(id: number, options?: RawAxiosRequestConfig): AxiosPromise<File> {
return localVarFp.getCardImageById(id, options).then((request) => request(axios, basePath));
},
/**
*
* @summary Get a page of Cards with optional name query parameter
* @param {string | null} [name]
* @param {number} [page]
* @param {number} [pageSize]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getCards(name?: string | null, page?: number, pageSize?: number, options?: RawAxiosRequestConfig): AxiosPromise<Array<Card>> {
return localVarFp.getCards(name, page, pageSize, options).then((request) => request(axios, basePath));
},
};
};
/**
* CardService - interface
* @export
* @interface CardService
*/
export interface CardServiceInterface {
/**
*
* @summary Test
* @param {number} id
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof CardServiceInterface
*/
apiCardsIdNewPut(id: number, options?: RawAxiosRequestConfig): AxiosPromise<void>;
/**
*
* @summary Get a singular Card by its ID
* @param {number} id
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof CardServiceInterface
*/
getCardById(id: number, options?: RawAxiosRequestConfig): AxiosPromise<NewCard>;
/**
*
* @summary Get the image of a Card by its ID
* @param {number} id
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof CardServiceInterface
*/
getCardImageById(id: number, options?: RawAxiosRequestConfig): AxiosPromise<File>;
/**
*
* @summary Get a page of Cards with optional name query parameter
* @param {string | null} [name]
* @param {number} [page]
* @param {number} [pageSize]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof CardServiceInterface
*/
getCards(name?: string | null, page?: number, pageSize?: number, options?: RawAxiosRequestConfig): AxiosPromise<Array<Card>>;
}
/**
* CardService - object-oriented interface
* @export
* @class CardService
* @extends {BaseAPI}
*/
export class CardService extends BaseAPI implements CardServiceInterface {
/**
*
* @summary Test
* @param {number} id
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof CardService
*/
public apiCardsIdNewPut(id: number, options?: RawAxiosRequestConfig) {
return CardServiceFp(this.configuration).apiCardsIdNewPut(id, options).then((request) => request(this.axios, this.basePath));
}
/**
*
* @summary Get a singular Card by its ID
* @param {number} id
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof CardService
*/
public getCardById(id: number, options?: RawAxiosRequestConfig) {
return CardServiceFp(this.configuration).getCardById(id, options).then((request) => request(this.axios, this.basePath));
}
/**
*
* @summary Get the image of a Card by its ID
* @param {number} id
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof CardService
*/
public getCardImageById(id: number, options?: RawAxiosRequestConfig) {
return CardServiceFp(this.configuration).getCardImageById(id, options).then((request) => request(this.axios, this.basePath));
}
/**
*
* @summary Get a page of Cards with optional name query parameter
* @param {string | null} [name]
* @param {number} [page]
* @param {number} [pageSize]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof CardService
*/
public getCards(name?: string | null, page?: number, pageSize?: number, options?: RawAxiosRequestConfig) {
return CardServiceFp(this.configuration).getCards(name, page, pageSize, options).then((request) => request(this.axios, this.basePath));
}
}

View File

@@ -0,0 +1,417 @@
/* tslint:disable */
/* eslint-disable */
/**
* dex API
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 0.0.1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import type { Configuration } from '../configuration';
import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios';
import globalAxios from 'axios';
// Some imports not used depending on template conditions
// @ts-ignore
import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../common';
// @ts-ignore
import { BASE_PATH, COLLECTION_FORMATS, type RequestArgs, BaseAPI, RequiredError, operationServerMap } from '../base';
// @ts-ignore
import type { Deck } from '../model';
// @ts-ignore
import type { PageDeck } from '../model';
/**
* DeckService - axios parameter creator
* @export
*/
export const DeckServiceAxiosParamCreator = function (configuration?: Configuration) {
return {
/**
*
* @summary Add a Card by its ID to a Deck by its name
* @param {number} cardId
* @param {string} deckName
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
addCardToDeck: async (cardId: number, deckName: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
// verify required parameter 'cardId' is not null or undefined
assertParamExists('addCardToDeck', 'cardId', cardId)
// verify required parameter 'deckName' is not null or undefined
assertParamExists('addCardToDeck', 'deckName', deckName)
const localVarPath = `/api/decks/{deckName}/{cardId}`
.replace(`{${"cardId"}}`, encodeURIComponent(String(cardId)))
.replace(`{${"deckName"}}`, encodeURIComponent(String(deckName)));
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
*
* @summary Create a Deck with a given name
* @param {Deck} deck
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createDeck: async (deck: Deck, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
// verify required parameter 'deck' is not null or undefined
assertParamExists('createDeck', 'deck', deck)
const localVarPath = `/api/decks`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
localVarHeaderParameter['Content-Type'] = 'application/json';
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
localVarRequestOptions.data = serializeDataIfNeeded(deck, localVarRequestOptions, configuration)
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
*
* @summary Get a singular Deck by its name
* @param {string} name
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getDeckByName: async (name: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
// verify required parameter 'name' is not null or undefined
assertParamExists('getDeckByName', 'name', name)
const localVarPath = `/api/decks/{name}`
.replace(`{${"name"}}`, encodeURIComponent(String(name)));
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
*
* @summary Get a page of Decks with optional name query parameter
* @param {string | null} [name]
* @param {number} [page]
* @param {number} [pageSize]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getDecks: async (name?: string | null, page?: number, pageSize?: number, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
const localVarPath = `/api/decks`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
if (name !== undefined) {
localVarQueryParameter['name'] = name;
}
if (page !== undefined) {
localVarQueryParameter['page'] = page;
}
if (pageSize !== undefined) {
localVarQueryParameter['pageSize'] = pageSize;
}
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
}
};
/**
* DeckService - functional programming interface
* @export
*/
export const DeckServiceFp = function(configuration?: Configuration) {
const localVarAxiosParamCreator = DeckServiceAxiosParamCreator(configuration)
return {
/**
*
* @summary Add a Card by its ID to a Deck by its name
* @param {number} cardId
* @param {string} deckName
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async addCardToDeck(cardId: number, deckName: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.addCardToDeck(cardId, deckName, options);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath = operationServerMap['DeckService.addCardToDeck']?.[localVarOperationServerIndex]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
},
/**
*
* @summary Create a Deck with a given name
* @param {Deck} deck
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async createDeck(deck: Deck, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.createDeck(deck, options);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath = operationServerMap['DeckService.createDeck']?.[localVarOperationServerIndex]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
},
/**
*
* @summary Get a singular Deck by its name
* @param {string} name
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async getDeckByName(name: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Deck>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.getDeckByName(name, options);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath = operationServerMap['DeckService.getDeckByName']?.[localVarOperationServerIndex]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
},
/**
*
* @summary Get a page of Decks with optional name query parameter
* @param {string | null} [name]
* @param {number} [page]
* @param {number} [pageSize]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async getDecks(name?: string | null, page?: number, pageSize?: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<PageDeck>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.getDecks(name, page, pageSize, options);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath = operationServerMap['DeckService.getDecks']?.[localVarOperationServerIndex]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
},
}
};
/**
* DeckService - factory interface
* @export
*/
export const DeckServiceFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
const localVarFp = DeckServiceFp(configuration)
return {
/**
*
* @summary Add a Card by its ID to a Deck by its name
* @param {number} cardId
* @param {string} deckName
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
addCardToDeck(cardId: number, deckName: string, options?: RawAxiosRequestConfig): AxiosPromise<void> {
return localVarFp.addCardToDeck(cardId, deckName, options).then((request) => request(axios, basePath));
},
/**
*
* @summary Create a Deck with a given name
* @param {Deck} deck
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createDeck(deck: Deck, options?: RawAxiosRequestConfig): AxiosPromise<void> {
return localVarFp.createDeck(deck, options).then((request) => request(axios, basePath));
},
/**
*
* @summary Get a singular Deck by its name
* @param {string} name
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getDeckByName(name: string, options?: RawAxiosRequestConfig): AxiosPromise<Deck> {
return localVarFp.getDeckByName(name, options).then((request) => request(axios, basePath));
},
/**
*
* @summary Get a page of Decks with optional name query parameter
* @param {string | null} [name]
* @param {number} [page]
* @param {number} [pageSize]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getDecks(name?: string | null, page?: number, pageSize?: number, options?: RawAxiosRequestConfig): AxiosPromise<PageDeck> {
return localVarFp.getDecks(name, page, pageSize, options).then((request) => request(axios, basePath));
},
};
};
/**
* DeckService - interface
* @export
* @interface DeckService
*/
export interface DeckServiceInterface {
/**
*
* @summary Add a Card by its ID to a Deck by its name
* @param {number} cardId
* @param {string} deckName
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof DeckServiceInterface
*/
addCardToDeck(cardId: number, deckName: string, options?: RawAxiosRequestConfig): AxiosPromise<void>;
/**
*
* @summary Create a Deck with a given name
* @param {Deck} deck
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof DeckServiceInterface
*/
createDeck(deck: Deck, options?: RawAxiosRequestConfig): AxiosPromise<void>;
/**
*
* @summary Get a singular Deck by its name
* @param {string} name
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof DeckServiceInterface
*/
getDeckByName(name: string, options?: RawAxiosRequestConfig): AxiosPromise<Deck>;
/**
*
* @summary Get a page of Decks with optional name query parameter
* @param {string | null} [name]
* @param {number} [page]
* @param {number} [pageSize]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof DeckServiceInterface
*/
getDecks(name?: string | null, page?: number, pageSize?: number, options?: RawAxiosRequestConfig): AxiosPromise<PageDeck>;
}
/**
* DeckService - object-oriented interface
* @export
* @class DeckService
* @extends {BaseAPI}
*/
export class DeckService extends BaseAPI implements DeckServiceInterface {
/**
*
* @summary Add a Card by its ID to a Deck by its name
* @param {number} cardId
* @param {string} deckName
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof DeckService
*/
public addCardToDeck(cardId: number, deckName: string, options?: RawAxiosRequestConfig) {
return DeckServiceFp(this.configuration).addCardToDeck(cardId, deckName, options).then((request) => request(this.axios, this.basePath));
}
/**
*
* @summary Create a Deck with a given name
* @param {Deck} deck
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof DeckService
*/
public createDeck(deck: Deck, options?: RawAxiosRequestConfig) {
return DeckServiceFp(this.configuration).createDeck(deck, options).then((request) => request(this.axios, this.basePath));
}
/**
*
* @summary Get a singular Deck by its name
* @param {string} name
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof DeckService
*/
public getDeckByName(name: string, options?: RawAxiosRequestConfig) {
return DeckServiceFp(this.configuration).getDeckByName(name, options).then((request) => request(this.axios, this.basePath));
}
/**
*
* @summary Get a page of Decks with optional name query parameter
* @param {string | null} [name]
* @param {number} [page]
* @param {number} [pageSize]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof DeckService
*/
public getDecks(name?: string | null, page?: number, pageSize?: number, options?: RawAxiosRequestConfig) {
return DeckServiceFp(this.configuration).getDecks(name, page, pageSize, options).then((request) => request(this.axios, this.basePath));
}
}

View File

@@ -0,0 +1,7 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "esnext",
"outDir": "dist/esm"
}
}

View File

@@ -0,0 +1,18 @@
{
"compilerOptions": {
"declaration": true,
"target": "ES6",
"module": "commonjs",
"noImplicitAny": true,
"outDir": "dist",
"rootDir": ".",
"moduleResolution": "node",
"typeRoots": [
"node_modules/@types"
]
},
"exclude": [
"dist",
"node_modules"
]
}

2
src/components.d.ts vendored
View File

@@ -8,7 +8,9 @@ export {}
/* prettier-ignore */ /* prettier-ignore */
declare module 'vue' { declare module 'vue' {
export interface GlobalComponents { export interface GlobalComponents {
DeckIcon: typeof import('./components/DeckIcon.vue')['default']
HelloWorld: typeof import('./components/HelloWorld.vue')['default'] HelloWorld: typeof import('./components/HelloWorld.vue')['default']
Image: typeof import('primevue/image')['default']
RouterLink: typeof import('vue-router')['RouterLink'] RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView'] RouterView: typeof import('vue-router')['RouterView']
VirtualScroller: typeof import('primevue/virtualscroller')['default'] VirtualScroller: typeof import('primevue/virtualscroller')['default']

View File

@@ -4,10 +4,12 @@ import App from './App.vue'
import PrimeVue from 'primevue/config'; import PrimeVue from 'primevue/config';
import Aura from '@primeuix/themes/aura'; import Aura from '@primeuix/themes/aura';
import {createMemoryHistory, createRouter, type Router, type RouteRecordRaw} from "vue-router"; import {createMemoryHistory, createRouter, type Router, type RouteRecordRaw} from "vue-router";
import Playground from "./views/Playground.vue"; import HomeView from "./views/HomeView.vue";
import {DeckService} from "./api/openapi";
import axios from "axios";
const routes: RouteRecordRaw[] = [ const routes: RouteRecordRaw[] = [
{path: '/foo', component: Playground} {path: '/', component: HomeView}
] ]
const router: Router = createRouter({ const router: Router = createRouter({
@@ -15,6 +17,11 @@ const router: Router = createRouter({
routes routes
}) })
export const axiosInstance = axios.create()
export const DeckServiceKey = Symbol("deckServiceKey")
const deckService: DeckService = new DeckService(undefined, "http://localhost:8080", axiosInstance)
const app = createApp(App); const app = createApp(App);
app.use(PrimeVue, { app.use(PrimeVue, {
theme: { theme: {
@@ -29,4 +36,6 @@ app.use(PrimeVue, {
}); });
app.use(router); app.use(router);
app.provide(DeckServiceKey, deckService)
app.mount('#app'); app.mount('#app');

32
src/views/HomeView.vue Normal file
View File

@@ -0,0 +1,32 @@
<template>
<div class="flex w-full justify-end">
<div class="flex flex-col" v-for="deck of decks">
<Image
src="https://images-wixmp-ed30a86b8c4ca887773594c2.wixmp.com/f/f1ea70e0-6b84-41e0-945a-9388d618e4a0/dc0ha2k-570434cb-39a2-41c8-8bc0-d6e0333a4f28.png?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ1cm46YXBwOjdlMGQxODg5ODIyNjQzNzNhNWYwZDQxNWVhMGQyNmUwIiwiaXNzIjoidXJuOmFwcDo3ZTBkMTg4OTgyMjY0MzczYTVmMGQ0MTVlYTBkMjZlMCIsIm9iaiI6W1t7InBhdGgiOiJcL2ZcL2YxZWE3MGUwLTZiODQtNDFlMC05NDVhLTkzODhkNjE4ZTRhMFwvZGMwaGEyay01NzA0MzRjYi0zOWEyLTQxYzgtOGJjMC1kNmUwMzMzYTRmMjgucG5nIn1dXSwiYXVkIjpbInVybjpzZXJ2aWNlOmZpbGUuZG93bmxvYWQiXX0.pUHo0NNlqIO7VPFnb-GFSzQX4e1xmI5ArXJNZBCiIwg"
alt="Image"
width="250"
preview
/>
hi! {{ deck.name}}
</div>
</div>
</template>
<script setup lang="ts">
import {inject, onMounted, ref, type Ref} from "vue";
import {DeckServiceKey} from "../main.ts";
import {type Deck, DeckService} from "../api/openapi";
const deckService: DeckService = inject(DeckServiceKey) as DeckService;
const decks: Ref<Deck[]> = ref([]);
onMounted(async () => {
decks.value = (await deckService.getDecks()).data.content
})
</script>
<style scoped>
</style>