Skip to content

Latest commit

 

History

History
650 lines (421 loc) · 16 KB

AuthApi.md

File metadata and controls

650 lines (421 loc) · 16 KB

\AuthApi

All URIs are relative to https://api.forestvpn.com/v2

Method HTTP request Description
AuthorizeAccessTokenRequest Post /auth/access-token-requests/{requestID}/authorize/ Authorize access token request
CreateAccessTokenRequest Post /auth/access-token-requests/ Create access token request
GetAccessTokenRequest Get /auth/access-token-requests/{requestID}/ Get access token request details
LoginToken Post /auth/token/login/ Login with JWT token
MigrateLegacyAuth Get /legacy/auth/ Legacy auth migration
ObtainToken Get /auth/token/obtain/ Obtain JWT token
RevokeAccessTokenRequest Post /auth/access-token-requests/{requestID}/revoke/ Revoke access token request
UpdateUserProfile Patch /auth/profile/ Update profile
UserProfile Get /auth/profile/ Profile
WhoAmI Get /auth/whoami/ Who am I

AuthorizeAccessTokenRequest

AccessTokenRequest AuthorizeAccessTokenRequest(ctx, requestID).Execute()

Authorize access token request

Example

package main

import (
    "context"
    "fmt"
    "os"
    openapiclient "./openapi"
)

func main() {
    requestID := "requestID_example" // string | 

    configuration := openapiclient.NewConfiguration()
    apiClient := openapiclient.NewAPIClient(configuration)
    resp, r, err := apiClient.AuthApi.AuthorizeAccessTokenRequest(context.Background(), requestID).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `AuthApi.AuthorizeAccessTokenRequest``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `AuthorizeAccessTokenRequest`: AccessTokenRequest
    fmt.Fprintf(os.Stdout, "Response from `AuthApi.AuthorizeAccessTokenRequest`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
requestID string

Other Parameters

Other parameters are passed through a pointer to a apiAuthorizeAccessTokenRequestRequest struct via the builder pattern

Name Type Description Notes

Return type

AccessTokenRequest

Authorization

bearerAuth

HTTP request headers

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

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

CreateAccessTokenRequest

AccessTokenRequest CreateAccessTokenRequest(ctx).Name(name).Execute()

Create access token request

Example

package main

import (
    "context"
    "fmt"
    "os"
    openapiclient "./openapi"
)

func main() {
    name := "name_example" // string |  (optional)

    configuration := openapiclient.NewConfiguration()
    apiClient := openapiclient.NewAPIClient(configuration)
    resp, r, err := apiClient.AuthApi.CreateAccessTokenRequest(context.Background()).Name(name).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `AuthApi.CreateAccessTokenRequest``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `CreateAccessTokenRequest`: AccessTokenRequest
    fmt.Fprintf(os.Stdout, "Response from `AuthApi.CreateAccessTokenRequest`: %v\n", resp)
}

Path Parameters

Other Parameters

Other parameters are passed through a pointer to a apiCreateAccessTokenRequestRequest struct via the builder pattern

Name Type Description Notes
name string

Return type

AccessTokenRequest

Authorization

bearerAuth

HTTP request headers

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

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

GetAccessTokenRequest

AccessTokenRequest GetAccessTokenRequest(ctx, requestID).Execute()

Get access token request details

Example

package main

import (
    "context"
    "fmt"
    "os"
    openapiclient "./openapi"
)

func main() {
    requestID := "requestID_example" // string | 

    configuration := openapiclient.NewConfiguration()
    apiClient := openapiclient.NewAPIClient(configuration)
    resp, r, err := apiClient.AuthApi.GetAccessTokenRequest(context.Background(), requestID).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `AuthApi.GetAccessTokenRequest``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `GetAccessTokenRequest`: AccessTokenRequest
    fmt.Fprintf(os.Stdout, "Response from `AuthApi.GetAccessTokenRequest`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
requestID string

Other Parameters

Other parameters are passed through a pointer to a apiGetAccessTokenRequestRequest struct via the builder pattern

Name Type Description Notes

Return type

AccessTokenRequest

Authorization

bearerAuth

HTTP request headers

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

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

LoginToken

TokenLogin LoginToken(ctx).CreateTokenLogin(createTokenLogin).Execute()

Login with JWT token

Example

package main

import (
    "context"
    "fmt"
    "os"
    openapiclient "./openapi"
)

func main() {
    createTokenLogin := *openapiclient.NewCreateTokenLogin("JwtToken_example") // CreateTokenLogin |  (optional)

    configuration := openapiclient.NewConfiguration()
    apiClient := openapiclient.NewAPIClient(configuration)
    resp, r, err := apiClient.AuthApi.LoginToken(context.Background()).CreateTokenLogin(createTokenLogin).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `AuthApi.LoginToken``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `LoginToken`: TokenLogin
    fmt.Fprintf(os.Stdout, "Response from `AuthApi.LoginToken`: %v\n", resp)
}

Path Parameters

Other Parameters

Other parameters are passed through a pointer to a apiLoginTokenRequest struct via the builder pattern

Name Type Description Notes
createTokenLogin CreateTokenLogin

Return type

TokenLogin

Authorization

bearerAuth

HTTP request headers

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

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

MigrateLegacyAuth

LegacyAuthMigrationToken MigrateLegacyAuth(ctx).Execute()

Legacy auth migration

Example

package main

import (
    "context"
    "fmt"
    "os"
    openapiclient "./openapi"
)

func main() {

    configuration := openapiclient.NewConfiguration()
    apiClient := openapiclient.NewAPIClient(configuration)
    resp, r, err := apiClient.AuthApi.MigrateLegacyAuth(context.Background()).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `AuthApi.MigrateLegacyAuth``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `MigrateLegacyAuth`: LegacyAuthMigrationToken
    fmt.Fprintf(os.Stdout, "Response from `AuthApi.MigrateLegacyAuth`: %v\n", resp)
}

Path Parameters

This endpoint does not need any parameter.

Other Parameters

Other parameters are passed through a pointer to a apiMigrateLegacyAuthRequest struct via the builder pattern

Return type

LegacyAuthMigrationToken

Authorization

bearerAuth

HTTP request headers

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

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

ObtainToken

TokenObtain ObtainToken(ctx).Execute()

Obtain JWT token

Example

package main

import (
    "context"
    "fmt"
    "os"
    openapiclient "./openapi"
)

func main() {

    configuration := openapiclient.NewConfiguration()
    apiClient := openapiclient.NewAPIClient(configuration)
    resp, r, err := apiClient.AuthApi.ObtainToken(context.Background()).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `AuthApi.ObtainToken``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `ObtainToken`: TokenObtain
    fmt.Fprintf(os.Stdout, "Response from `AuthApi.ObtainToken`: %v\n", resp)
}

Path Parameters

This endpoint does not need any parameter.

Other Parameters

Other parameters are passed through a pointer to a apiObtainTokenRequest struct via the builder pattern

Return type

TokenObtain

Authorization

bearerAuth

HTTP request headers

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

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

RevokeAccessTokenRequest

AccessTokenRequest RevokeAccessTokenRequest(ctx, requestID).Execute()

Revoke access token request

Example

package main

import (
    "context"
    "fmt"
    "os"
    openapiclient "./openapi"
)

func main() {
    requestID := "requestID_example" // string | 

    configuration := openapiclient.NewConfiguration()
    apiClient := openapiclient.NewAPIClient(configuration)
    resp, r, err := apiClient.AuthApi.RevokeAccessTokenRequest(context.Background(), requestID).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `AuthApi.RevokeAccessTokenRequest``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `RevokeAccessTokenRequest`: AccessTokenRequest
    fmt.Fprintf(os.Stdout, "Response from `AuthApi.RevokeAccessTokenRequest`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
requestID string

Other Parameters

Other parameters are passed through a pointer to a apiRevokeAccessTokenRequestRequest struct via the builder pattern

Name Type Description Notes

Return type

AccessTokenRequest

Authorization

bearerAuth

HTTP request headers

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

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

UpdateUserProfile

User UpdateUserProfile(ctx).User(user).Execute()

Update profile

Example

package main

import (
    "context"
    "fmt"
    "os"
    openapiclient "./openapi"
)

func main() {
    user := *openapiclient.NewUser("Id_example", "Username_example") // User |  (optional)

    configuration := openapiclient.NewConfiguration()
    apiClient := openapiclient.NewAPIClient(configuration)
    resp, r, err := apiClient.AuthApi.UpdateUserProfile(context.Background()).User(user).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `AuthApi.UpdateUserProfile``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `UpdateUserProfile`: User
    fmt.Fprintf(os.Stdout, "Response from `AuthApi.UpdateUserProfile`: %v\n", resp)
}

Path Parameters

Other Parameters

Other parameters are passed through a pointer to a apiUpdateUserProfileRequest struct via the builder pattern

Name Type Description Notes
user User

Return type

User

Authorization

bearerAuth

HTTP request headers

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

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

UserProfile

User UserProfile(ctx).Execute()

Profile

Example

package main

import (
    "context"
    "fmt"
    "os"
    openapiclient "./openapi"
)

func main() {

    configuration := openapiclient.NewConfiguration()
    apiClient := openapiclient.NewAPIClient(configuration)
    resp, r, err := apiClient.AuthApi.UserProfile(context.Background()).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `AuthApi.UserProfile``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `UserProfile`: User
    fmt.Fprintf(os.Stdout, "Response from `AuthApi.UserProfile`: %v\n", resp)
}

Path Parameters

This endpoint does not need any parameter.

Other Parameters

Other parameters are passed through a pointer to a apiUserProfileRequest struct via the builder pattern

Return type

User

Authorization

bearerAuth

HTTP request headers

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

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

WhoAmI

User WhoAmI(ctx).Execute()

Who am I

Example

package main

import (
    "context"
    "fmt"
    "os"
    openapiclient "./openapi"
)

func main() {

    configuration := openapiclient.NewConfiguration()
    apiClient := openapiclient.NewAPIClient(configuration)
    resp, r, err := apiClient.AuthApi.WhoAmI(context.Background()).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `AuthApi.WhoAmI``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `WhoAmI`: User
    fmt.Fprintf(os.Stdout, "Response from `AuthApi.WhoAmI`: %v\n", resp)
}

Path Parameters

This endpoint does not need any parameter.

Other Parameters

Other parameters are passed through a pointer to a apiWhoAmIRequest struct via the builder pattern

Return type

User

Authorization

bearerAuth

HTTP request headers

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

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