Skip to content

Latest commit

 

History

History
330 lines (242 loc) · 8.4 KB

APITokensApi.md

File metadata and controls

330 lines (242 loc) · 8.4 KB

PollinationSDK.Api.APITokensApi

All URIs are relative to http://localhost

Method HTTP request Description
CreateToken POST /tokens Create a new API token
DeleteToken DELETE /tokens/{token_id} Delete an API Token
ListTokens GET /tokens List user API tokens
RegenerateToken PUT /tokens/{token_id} Regenerate an API token

CreateToken

APITokenPrivate CreateToken (APITokenCreate aPITokenCreate)

Create a new API token

Create a new API token

Example

using System.Collections.Generic;
using System.Diagnostics;
using PollinationSDK.Api;
using PollinationSDK.Client;
using PollinationSDK.Model;

namespace Example
{
    public class CreateTokenExample
    {
        public static void Main()
        {
            Configuration.Default.BasePath = "http://localhost";
            // Configure HTTP bearer authorization: JWTAuth
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new APITokensApi(Configuration.Default);
            var aPITokenCreate = new APITokenCreate(); // APITokenCreate | 

            try
            {
                // Create a new API token
                APITokenPrivate result = apiInstance.CreateToken(aPITokenCreate);
                Debug.WriteLine(result);
            }
            catch (ApiException e)
            {
                Debug.Print("Exception when calling APITokensApi.CreateToken: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

Name Type Description Notes
aPITokenCreate APITokenCreate

Return type

APITokenPrivate

Authorization

JWTAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
201 Successful Response -
422 Validation Error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

DeleteToken

AnyType DeleteToken (string tokenId)

Delete an API Token

Delete a token

Example

using System.Collections.Generic;
using System.Diagnostics;
using PollinationSDK.Api;
using PollinationSDK.Client;
using PollinationSDK.Model;

namespace Example
{
    public class DeleteTokenExample
    {
        public static void Main()
        {
            Configuration.Default.BasePath = "http://localhost";
            // Configure HTTP bearer authorization: JWTAuth
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new APITokensApi(Configuration.Default);
            var tokenId = tokenId_example;  // string | 

            try
            {
                // Delete an API Token
                AnyType result = apiInstance.DeleteToken(tokenId);
                Debug.WriteLine(result);
            }
            catch (ApiException e)
            {
                Debug.Print("Exception when calling APITokensApi.DeleteToken: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

Name Type Description Notes
tokenId string

Return type

AnyType

Authorization

JWTAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
202 Successful Response -
422 Validation Error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

ListTokens

APITokenList ListTokens (int? page = null, int? perPage = null)

List user API tokens

List API tokens for the authenticated user

Example

using System.Collections.Generic;
using System.Diagnostics;
using PollinationSDK.Api;
using PollinationSDK.Client;
using PollinationSDK.Model;

namespace Example
{
    public class ListTokensExample
    {
        public static void Main()
        {
            Configuration.Default.BasePath = "http://localhost";
            // Configure HTTP bearer authorization: JWTAuth
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new APITokensApi(Configuration.Default);
            var page = 56;  // int? | Page number starting from 1 (optional)  (default to 1)
            var perPage = 56;  // int? | Number of items per page (optional)  (default to 25)

            try
            {
                // List user API tokens
                APITokenList result = apiInstance.ListTokens(page, perPage);
                Debug.WriteLine(result);
            }
            catch (ApiException e)
            {
                Debug.Print("Exception when calling APITokensApi.ListTokens: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

Name Type Description Notes
page int? Page number starting from 1 [optional] [default to 1]
perPage int? Number of items per page [optional] [default to 25]

Return type

APITokenList

Authorization

JWTAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Successful Response -
422 Validation Error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

RegenerateToken

APITokenPrivate RegenerateToken (string tokenId)

Regenerate an API token

Regenerate a token

Example

using System.Collections.Generic;
using System.Diagnostics;
using PollinationSDK.Api;
using PollinationSDK.Client;
using PollinationSDK.Model;

namespace Example
{
    public class RegenerateTokenExample
    {
        public static void Main()
        {
            Configuration.Default.BasePath = "http://localhost";
            // Configure HTTP bearer authorization: JWTAuth
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new APITokensApi(Configuration.Default);
            var tokenId = tokenId_example;  // string | 

            try
            {
                // Regenerate an API token
                APITokenPrivate result = apiInstance.RegenerateToken(tokenId);
                Debug.WriteLine(result);
            }
            catch (ApiException e)
            {
                Debug.Print("Exception when calling APITokensApi.RegenerateToken: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

Name Type Description Notes
tokenId string

Return type

APITokenPrivate

Authorization

JWTAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
201 Successful Response -
422 Validation Error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]