Skip to content

Latest commit

 

History

History
336 lines (251 loc) · 8.94 KB

UserApi.md

File metadata and controls

336 lines (251 loc) · 8.94 KB

PollinationSDK.Api.UserApi

All URIs are relative to http://localhost

Method HTTP request Description
CreateUser POST /user Register a new user
GetMe GET /user Get authenticated user profile.
GetRoles GET /user/roles Get the authenticated user roles
UpdateUserProfile PUT /user Update the authenticated user

CreateUser

CreatedContent CreateUser (UserCreate userCreate)

Register a new user

Create a new user.

Example

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

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

            var apiInstance = new UserApi(Configuration.Default);
            var userCreate = new UserCreate(); // UserCreate | 

            try
            {
                // Register a new user
                CreatedContent result = apiInstance.CreateUser(userCreate);
                Debug.WriteLine(result);
            }
            catch (ApiException e)
            {
                Debug.Print("Exception when calling UserApi.CreateUser: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

Name Type Description Notes
userCreate UserCreate

Return type

CreatedContent

Authorization

JWTAuth

HTTP request headers

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

HTTP response details

Status code Description Response headers
201 Success -
403 Access forbidden -
500 Server error -
400 Invalid request -
202 Accepted -
422 Validation Error -

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

GetMe

UserPrivate GetMe ()

Get authenticated user profile.

Get authenticated user profile

Example

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

namespace Example
{
    public class GetMeExample
    {
        public static void Main()
        {
            Configuration.Default.BasePath = "http://localhost";
            // Configure API key authorization: APIKeyAuth
            Configuration.Default.AddApiKey("x-pollination-token", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // Configuration.Default.AddApiKeyPrefix("x-pollination-token", "Bearer");
            // Configure HTTP bearer authorization: JWTAuth
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new UserApi(Configuration.Default);

            try
            {
                // Get authenticated user profile.
                UserPrivate result = apiInstance.GetMe();
                Debug.WriteLine(result);
            }
            catch (ApiException e)
            {
                Debug.Print("Exception when calling UserApi.GetMe: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

This endpoint does not need any parameter.

Return type

UserPrivate

Authorization

APIKeyAuth, JWTAuth

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Successful Response -

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

GetRoles

List<string> GetRoles ()

Get the authenticated user roles

Example

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

namespace Example
{
    public class GetRolesExample
    {
        public static void Main()
        {
            Configuration.Default.BasePath = "http://localhost";
            // Configure API key authorization: APIKeyAuth
            Configuration.Default.AddApiKey("x-pollination-token", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // Configuration.Default.AddApiKeyPrefix("x-pollination-token", "Bearer");
            // Configure HTTP bearer authorization: JWTAuth
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new UserApi(Configuration.Default);

            try
            {
                // Get the authenticated user roles
                List<string> result = apiInstance.GetRoles();
                Debug.WriteLine(result);
            }
            catch (ApiException e)
            {
                Debug.Print("Exception when calling UserApi.GetRoles: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

This endpoint does not need any parameter.

Return type

List

Authorization

APIKeyAuth, JWTAuth

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Successful Response -

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

UpdateUserProfile

UpdateAccepted UpdateUserProfile (UserUpdate userUpdate)

Update the authenticated user

Update the authenticated user profile

Example

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

namespace Example
{
    public class UpdateUserProfileExample
    {
        public static void Main()
        {
            Configuration.Default.BasePath = "http://localhost";
            // Configure API key authorization: APIKeyAuth
            Configuration.Default.AddApiKey("x-pollination-token", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // Configuration.Default.AddApiKeyPrefix("x-pollination-token", "Bearer");
            // Configure HTTP bearer authorization: JWTAuth
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new UserApi(Configuration.Default);
            var userUpdate = new UserUpdate(); // UserUpdate | 

            try
            {
                // Update the authenticated user
                UpdateAccepted result = apiInstance.UpdateUserProfile(userUpdate);
                Debug.WriteLine(result);
            }
            catch (ApiException e)
            {
                Debug.Print("Exception when calling UserApi.UpdateUserProfile: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

Name Type Description Notes
userUpdate UserUpdate

Return type

UpdateAccepted

Authorization

APIKeyAuth, JWTAuth

HTTP request headers

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

HTTP response details

Status code Description Response headers
202 Accepted -
403 Access forbidden -
500 Server error -
400 Invalid request -
404 Not found -
422 Validation Error -

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