UNPKG

@space-cow-media/spellbook-client

Version:

An Open Api generated client for the Commander Spellbook backend REST API.

176 lines (125 loc) 4.8 kB
# VariantsApi All URIs are relative to *http://localhost* | Method | HTTP request | Description | |------------- | ------------- | -------------| | [**variantsList**](VariantsApi.md#variantslist) | **GET** /variants/ | | | [**variantsRetrieve**](VariantsApi.md#variantsretrieve) | **GET** /variants/{id}/ | | ## variantsList > PaginatedVariantList variantsList(groupByCombo, limit, offset, ordering, q, variant) ### Example ```ts import { Configuration, VariantsApi, } from ''; import type { VariantsListRequest } from ''; async function example() { console.log("🚀 Testing SDK..."); const config = new Configuration({ // To configure HTTP basic authorization: basicAuth username: "YOUR USERNAME", password: "YOUR PASSWORD", // To configure API key authorization: cookieAuth apiKey: "YOUR API KEY", // Configure HTTP bearer authorization: jwtAuth accessToken: "YOUR BEARER TOKEN", }); const api = new VariantsApi(config); const body = { // boolean | Group variants by combo (optional) groupByCombo: true, // number | Number of results to return per page. (optional) limit: 56, // number | The initial index from which to return the results. (optional) offset: 56, // string | Which field to use when ordering the results. (optional) ordering: ordering_example, // string | A search query. (optional) q: q_example, // string | Filters for variants of the same combos that generated the given variant id. (optional) variant: variant_example, } satisfies VariantsListRequest; try { const data = await api.variantsList(body); console.log(data); } catch (error) { console.error(error); } } // Run the test example().catch(console.error); ``` ### Parameters | Name | Type | Description | Notes | |------------- | ------------- | ------------- | -------------| | **groupByCombo** | `boolean` | Group variants by combo | [Optional] [Defaults to `undefined`] | | **limit** | `number` | Number of results to return per page. | [Optional] [Defaults to `undefined`] | | **offset** | `number` | The initial index from which to return the results. | [Optional] [Defaults to `undefined`] | | **ordering** | `string` | Which field to use when ordering the results. | [Optional] [Defaults to `undefined`] | | **q** | `string` | A search query. | [Optional] [Defaults to `undefined`] | | **variant** | `string` | Filters for variants of the same combos that generated the given variant id. | [Optional] [Defaults to `undefined`] | ### Return type [**PaginatedVariantList**](PaginatedVariantList.md) ### Authorization [basicAuth](../README.md#basicAuth), [cookieAuth](../README.md#cookieAuth), [jwtAuth](../README.md#jwtAuth) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: `application/json` ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| | **200** | | - | | **400** | | - | [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md) ## variantsRetrieve > Variant variantsRetrieve(id) ### Example ```ts import { Configuration, VariantsApi, } from ''; import type { VariantsRetrieveRequest } from ''; async function example() { console.log("🚀 Testing SDK..."); const config = new Configuration({ // To configure HTTP basic authorization: basicAuth username: "YOUR USERNAME", password: "YOUR PASSWORD", // To configure API key authorization: cookieAuth apiKey: "YOUR API KEY", // Configure HTTP bearer authorization: jwtAuth accessToken: "YOUR BEARER TOKEN", }); const api = new VariantsApi(config); const body = { // string id: id_example, } satisfies VariantsRetrieveRequest; try { const data = await api.variantsRetrieve(body); console.log(data); } catch (error) { console.error(error); } } // Run the test example().catch(console.error); ``` ### Parameters | Name | Type | Description | Notes | |------------- | ------------- | ------------- | -------------| | **id** | `string` | | [Defaults to `undefined`] | ### Return type [**Variant**](Variant.md) ### Authorization [basicAuth](../README.md#basicAuth), [cookieAuth](../README.md#cookieAuth), [jwtAuth](../README.md#jwtAuth) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: `application/json` ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| | **200** | | - | | **400** | | - | [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)