lab5e / go-spanuserapi

User API for the Span service

Repository from Github https://github.comlab5e/go-spanuserapiRepository from Github https://github.comlab5e/go-spanuserapi

Go API client for spanuserapi

API for sessions, teams and API tokens

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: [version] [name]
  • Package version: 1.0.0
  • Build package: org.openapitools.codegen.languages.GoClientCodegen For more information, please visit https://lab5e.com

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 spanuserapi "github.com/lab5e/go-spanuserapi"

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 sw.ContextServerIndex of type int.

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

Templated Server URL

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

ctx := context.WithValue(context.Background(), spanuserapi.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 sw.ContextOperationServerIndices and sw.ContextOperationServerVariables context maps.

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

Documentation for API Endpoints

All URIs are relative to https://api.lab5e.com

Class Method HTTP request Description
OrgsApi AddAPIToken Post /dejavu/v1/orgs/{orgId}/teams/{teamId}/apitokens Add API token to team
OrgsApi AddTeamMember Post /dejavu/v1/orgs/{orgId}/teams/{teamId}/members Add a team member
OrgsApi CreateOrg Post /dejavu/v1/orgs Create new organisation
OrgsApi CreateOrgInvites Post /dejavu/v1/orgs/{orgId}/invites Invite members into org
OrgsApi CreateOrgTeam Post /dejavu/v1/orgs/{orgId}/teams Create a team
OrgsApi DeleteOrg Delete /dejavu/v1/orgs/{orgId} Delete organisation
OrgsApi DeleteOrgTeam Delete /dejavu/v1/orgs/{orgId}/teams/{teamId} Delete a team
OrgsApi GetAPIToken Get /dejavu/v1/orgs/{orgId}/teams/{teamId}/apitokens/{tokenId} Retrieve API token
OrgsApi GetOrg Get /dejavu/v1/orgs/{orgId} Organisation details
OrgsApi GetOrgTeam Get /dejavu/v1/orgs/{orgId}/teams/{teamId} Retrieve team information
OrgsApi HandleInvite Patch /dejavu/v1/orgs/invites/{inviteId} Respond to invite
OrgsApi ListAPITokens Get /dejavu/v1/orgs/{orgId}/teams/apitokens List API tokens for teams in organisation
OrgsApi ListInvites Post /dejavu/v1/orgs/invites List invites
OrgsApi ListOrgMembers Get /dejavu/v1/orgs/{orgId}/members List members of organisation
OrgsApi ListOrgTeams Get /dejavu/v1/orgs/{orgId}/teams List teams in org
OrgsApi ListOrgs Get /dejavu/v1/orgs List organisations
OrgsApi RemoveAPIToken Delete /dejavu/v1/orgs/{orgId}/teams/{teamId}/apitokens/{tokenId} Remove API token from team
OrgsApi RemoveOrgMember Delete /dejavu/v1/orgs/{orgId}/members/{memberId} Remove member from organisation
OrgsApi RemoveTeamMember Delete /dejavu/v1/orgs/{orgId}/teams/{teamId}/members/{memberId} Remove a member from a team
OrgsApi UpdateAPIToken Patch /dejavu/v1/orgs/{orgId}/teams/{teamId}/apitokens/{tokenId} Update API token
OrgsApi UpdateOrg Patch /dejavu/v1/orgs/{orgId} Update organisation
OrgsApi UpdateOrgMemberRole Patch /dejavu/v1/orgs/{orgId}/members/{memberId} Update org member role
OrgsApi UpdateOrgTeam Patch /dejavu/v1/orgs/{orgId}/teams/{teamId} Update a team
OrgsApi UpdateTeamMember Patch /dejavu/v1/orgs/{orgId}/teams/{teamId}/members Change membership role for a team member
ProfileApi NewMFAToken Post /dejavu/v1/mfa/new Assign MFA token
ProfileApi Profile Get /dejavu/v1/profile Retrieve profile
ProfileApi RemoveMFAToken Post /dejavu/v1/mfa/remove Remove MFA token
ProfileApi UpdatePassword Post /dejavu/v1/profile/password Change password
ProfileApi UpdateProfile Post /dejavu/v1/profile Update profile
ProfileApi VerifyNewMFAToken Post /dejavu/v1/mfa/verify Verify MFA token
ProfileApi VerifyPhone Post /dejavu/v1/phone/verify Verify phone number
SessionApi ListSessions Post /dejavu/v1/sessions List sessions
SessionApi Login Post /dejavu/v1/login Sign in to the service
SessionApi Logout Post /dejavu/v1/logout Sign out
SessionApi RecoverPassword Post /dejavu/v1/recover Recover/reset password
SignupApi EndUserLicenseAgreement Get /dejavu/v1/eula EULA text
SignupApi GetGithubProfile Get /dejavu/v1/ghprofile/{githubToken} Retrieve GitHub profile
SignupApi Signup Post /dejavu/v1/signup Sign up new user
SignupApi UpdateGithubProfile Post /dejavu/v1/ghprofile/{githubToken} Update GitHub profile
SignupApi VerifyEmail Post /dejavu/v1/verifyemail Verify email
SignupApi VerifyGithubProfile Post /dejavu/v1/ghprofile/{emailToken}/verify Verify GitHub profile

Documentation For Models

Documentation For Authorization

APIToken

  • Type: API key
  • API key parameter name: X-API-Token
  • Location: HTTP header

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

bearer

  • 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.

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

contact@lab5e.com

About

User API for the Span service