@space-cow-media/spellbook-client
Version:
An Open Api generated client for the Commander Spellbook backend REST API.
213 lines (136 loc) • 4.84 kB
Markdown
# TokenApi
All URIs are relative to *http://localhost*
| Method | HTTP request | Description |
|------------- | ------------- | -------------|
| [**tokenCreate**](TokenApi.md#tokencreate) | **POST** /token/ | |
| [**tokenRefreshCreate**](TokenApi.md#tokenrefreshcreate) | **POST** /token/refresh/ | |
| [**tokenVerifyCreate**](TokenApi.md#tokenverifycreate) | **POST** /token/verify/ | |
## tokenCreate
> TokenObtainPair tokenCreate(tokenObtainPairRequest)
Takes a set of user credentials and returns an access and refresh JSON web token pair to prove the authentication of those credentials.
### Example
```ts
import {
Configuration,
TokenApi,
} from '';
import type { TokenCreateRequest } from '';
async function example() {
console.log("🚀 Testing SDK...");
const api = new TokenApi();
const body = {
// TokenObtainPairRequest (optional)
tokenObtainPairRequest: ...,
} satisfies TokenCreateRequest;
try {
const data = await api.tokenCreate(body);
console.log(data);
} catch (error) {
console.error(error);
}
}
// Run the test
example().catch(console.error);
```
### Parameters
| Name | Type | Description | Notes |
|------------- | ------------- | ------------- | -------------|
| **tokenObtainPairRequest** | [TokenObtainPairRequest](TokenObtainPairRequest.md) | | [Optional] |
### Return type
[**TokenObtainPair**](TokenObtainPair.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: `application/json`, `application/x-www-form-urlencoded`, `multipart/form-data`
- **Accept**: `application/json`
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | | - |
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
## tokenRefreshCreate
> TokenRefresh tokenRefreshCreate(tokenRefreshRequest)
Takes a refresh type JSON web token and returns an access type JSON web token if the refresh token is valid.
### Example
```ts
import {
Configuration,
TokenApi,
} from '';
import type { TokenRefreshCreateRequest } from '';
async function example() {
console.log("🚀 Testing SDK...");
const api = new TokenApi();
const body = {
// TokenRefreshRequest
tokenRefreshRequest: ...,
} satisfies TokenRefreshCreateRequest;
try {
const data = await api.tokenRefreshCreate(body);
console.log(data);
} catch (error) {
console.error(error);
}
}
// Run the test
example().catch(console.error);
```
### Parameters
| Name | Type | Description | Notes |
|------------- | ------------- | ------------- | -------------|
| **tokenRefreshRequest** | [TokenRefreshRequest](TokenRefreshRequest.md) | | |
### Return type
[**TokenRefresh**](TokenRefresh.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: `application/json`, `application/x-www-form-urlencoded`, `multipart/form-data`
- **Accept**: `application/json`
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | | - |
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
## tokenVerifyCreate
> tokenVerifyCreate(tokenVerifyRequest)
Takes a token and indicates if it is valid. This view provides no information about a token\'s fitness for a particular use.
### Example
```ts
import {
Configuration,
TokenApi,
} from '';
import type { TokenVerifyCreateRequest } from '';
async function example() {
console.log("🚀 Testing SDK...");
const api = new TokenApi();
const body = {
// TokenVerifyRequest
tokenVerifyRequest: ...,
} satisfies TokenVerifyCreateRequest;
try {
const data = await api.tokenVerifyCreate(body);
console.log(data);
} catch (error) {
console.error(error);
}
}
// Run the test
example().catch(console.error);
```
### Parameters
| Name | Type | Description | Notes |
|------------- | ------------- | ------------- | -------------|
| **tokenVerifyRequest** | [TokenVerifyRequest](TokenVerifyRequest.md) | | |
### Return type
`void` (Empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: `application/json`, `application/x-www-form-urlencoded`, `multipart/form-data`
- **Accept**: Not defined
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | No response body | - |
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)