bweston92 / kratos-client-go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Go API client for client

This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more.

Overview

This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.

  • API version: v1.1.0
  • Package version: 1.0.0
  • Build package: org.openapitools.codegen.languages.GoClientCodegen

Installation

Install the following dependencies:

go get github.com/stretchr/testify/assert
go get golang.org/x/net/context

Put the package under your project folder and add the following in import:

import client "github.com/ory/kratos-client-go"

To use a proxy, set the environment variable HTTP_PROXY:

os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")

Configuration of Server URL

Default configuration comes with Servers field that contains server objects as defined in the OpenAPI specification.

Select Server Configuration

For using other server than the one defined on index 0 set context value client.ContextServerIndex of type int.

ctx := context.WithValue(context.Background(), client.ContextServerIndex, 1)

Templated Server URL

Templated server URL is formatted using default variables from configuration or from context value client.ContextServerVariables of type map[string]string.

ctx := context.WithValue(context.Background(), client.ContextServerVariables, map[string]string{
	"basePath": "v2",
})

Note, enum values are always validated and all unused variables are silently ignored.

URLs Configuration per Operation

Each operation can use different server URL defined using OperationServers map in the Configuration. An operation is uniquely identified by "{classname}Service.{nickname}" string. Similar rules for overriding default operation server index and variables applies by using client.ContextOperationServerIndices and client.ContextOperationServerVariables context maps.

ctx := context.WithValue(context.Background(), client.ContextOperationServerIndices, map[string]int{
	"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), client.ContextOperationServerVariables, map[string]map[string]string{
	"{classname}Service.{nickname}": {
		"port": "8443",
	},
})

Documentation for API Endpoints

All URIs are relative to http://localhost

Class Method HTTP request Description
CourierAPI GetCourierMessage Get /admin/courier/messages/{id} Get a Message
CourierAPI ListCourierMessages Get /admin/courier/messages List Messages
FrontendAPI CreateBrowserLoginFlow Get /self-service/login/browser Create Login Flow for Browsers
FrontendAPI CreateBrowserLogoutFlow Get /self-service/logout/browser Create a Logout URL for Browsers
FrontendAPI CreateBrowserRecoveryFlow Get /self-service/recovery/browser Create Recovery Flow for Browsers
FrontendAPI CreateBrowserRegistrationFlow Get /self-service/registration/browser Create Registration Flow for Browsers
FrontendAPI CreateBrowserSettingsFlow Get /self-service/settings/browser Create Settings Flow for Browsers
FrontendAPI CreateBrowserVerificationFlow Get /self-service/verification/browser Create Verification Flow for Browser Clients
FrontendAPI CreateNativeLoginFlow Get /self-service/login/api Create Login Flow for Native Apps
FrontendAPI CreateNativeRecoveryFlow Get /self-service/recovery/api Create Recovery Flow for Native Apps
FrontendAPI CreateNativeRegistrationFlow Get /self-service/registration/api Create Registration Flow for Native Apps
FrontendAPI CreateNativeSettingsFlow Get /self-service/settings/api Create Settings Flow for Native Apps
FrontendAPI CreateNativeVerificationFlow Get /self-service/verification/api Create Verification Flow for Native Apps
FrontendAPI DisableMyOtherSessions Delete /sessions Disable my other sessions
FrontendAPI DisableMySession Delete /sessions/{id} Disable one of my sessions
FrontendAPI ExchangeSessionToken Get /sessions/token-exchange Exchange Session Token
FrontendAPI GetFlowError Get /self-service/errors Get User-Flow Errors
FrontendAPI GetLoginFlow Get /self-service/login/flows Get Login Flow
FrontendAPI GetRecoveryFlow Get /self-service/recovery/flows Get Recovery Flow
FrontendAPI GetRegistrationFlow Get /self-service/registration/flows Get Registration Flow
FrontendAPI GetSettingsFlow Get /self-service/settings/flows Get Settings Flow
FrontendAPI GetVerificationFlow Get /self-service/verification/flows Get Verification Flow
FrontendAPI GetWebAuthnJavaScript Get /.well-known/ory/webauthn.js Get WebAuthn JavaScript
FrontendAPI ListMySessions Get /sessions Get My Active Sessions
FrontendAPI PerformNativeLogout Delete /self-service/logout/api Perform Logout for Native Apps
FrontendAPI ToSession Get /sessions/whoami Check Who the Current HTTP Session Belongs To
FrontendAPI UpdateLoginFlow Post /self-service/login Submit a Login Flow
FrontendAPI UpdateLogoutFlow Get /self-service/logout Update Logout Flow
FrontendAPI UpdateRecoveryFlow Post /self-service/recovery Update Recovery Flow
FrontendAPI UpdateRegistrationFlow Post /self-service/registration Update Registration Flow
FrontendAPI UpdateSettingsFlow Post /self-service/settings Complete Settings Flow
FrontendAPI UpdateVerificationFlow Post /self-service/verification Complete Verification Flow
IdentityAPI BatchPatchIdentities Patch /admin/identities Create and deletes multiple identities
IdentityAPI CreateIdentity Post /admin/identities Create an Identity
IdentityAPI CreateRecoveryCodeForIdentity Post /admin/recovery/code Create a Recovery Code
IdentityAPI CreateRecoveryLinkForIdentity Post /admin/recovery/link Create a Recovery Link
IdentityAPI DeleteIdentity Delete /admin/identities/{id} Delete an Identity
IdentityAPI DeleteIdentityCredentials Delete /admin/identities/{id}/credentials/{type} Delete a credential for a specific identity
IdentityAPI DeleteIdentitySessions Delete /admin/identities/{id}/sessions Delete & Invalidate an Identity's Sessions
IdentityAPI DisableSession Delete /admin/sessions/{id} Deactivate a Session
IdentityAPI ExtendSession Patch /admin/sessions/{id}/extend Extend a Session
IdentityAPI GetIdentity Get /admin/identities/{id} Get an Identity
IdentityAPI GetIdentitySchema Get /schemas/{id} Get Identity JSON Schema
IdentityAPI GetSession Get /admin/sessions/{id} Get Session
IdentityAPI ListIdentities Get /admin/identities List Identities
IdentityAPI ListIdentitySchemas Get /schemas Get all Identity Schemas
IdentityAPI ListIdentitySessions Get /admin/identities/{id}/sessions List an Identity's Sessions
IdentityAPI ListSessions Get /admin/sessions List All Sessions
IdentityAPI PatchIdentity Patch /admin/identities/{id} Patch an Identity
IdentityAPI UpdateIdentity Put /admin/identities/{id} Update an Identity
MetadataAPI GetVersion Get /version Return Running Software Version.
MetadataAPI IsAlive Get /health/alive Check HTTP Server Status
MetadataAPI IsReady Get /health/ready Check HTTP Server and Database Status

Documentation For Models

Documentation For Authorization

Authentication schemes defined for the API:

oryAccessToken

  • Type: API key
  • API key parameter name: Authorization
  • Location: HTTP header

Note, each API key must be added to a map of map[string]APIKey where the key is: Authorization and passed in as the auth context for each request.

Example

auth := context.WithValue(
		context.Background(),
		client.ContextAPIKeys,
		map[string]client.APIKey{
			"Authorization": {Key: "API_KEY_STRING"},
		},
	)
r, err := client.Service.Operation(auth, args)

Documentation for Utility Methods

Due to the fact that model structure members are all pointers, this package contains a number of utility functions to easily obtain pointers to values of basic types. Each of these functions takes a value of the given basic type and returns a pointer to it:

  • PtrBool
  • PtrInt
  • PtrInt32
  • PtrInt64
  • PtrFloat
  • PtrFloat32
  • PtrFloat64
  • PtrString
  • PtrTime

Author

office@ory.sh

About

License:Apache License 2.0


Languages

Language:Shell 100.0%