Files

14 KiB

Go API client for membershipclient

No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

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: 0.1.0
  • Package version: latest
  • Build package: org.openapitools.codegen.languages.GoClientCodegen

Installation

Install the following dependencies:

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

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

import membershipclient "github.com/formancehq/fctl/membershipclient"

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(), membershipclient.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(), membershipclient.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(), membershipclient.ContextOperationServerIndices, map[string]int{
	"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), membershipclient.ContextOperationServerVariables, map[string]map[string]string{
	"{classname}Service.{nickname}": {
		"port": "8443",
	},
})

Documentation for API Endpoints

All URIs are relative to http://localhost:8080

Class Method HTTP request Description
DefaultApi AcceptInvitation Post /me/invitations/{invitationId}/accept Accept invitation
DefaultApi CreateInvitation Post /organizations/{organizationId}/invitations Create invitation
DefaultApi CreateOrganization Post /organizations Create organization
DefaultApi CreatePrivateRegion Post /organizations/{organizationId}/regions Create a private region
DefaultApi CreateStack Post /organizations/{organizationId}/stacks Create stack
DefaultApi DeclineInvitation Post /me/invitations/{invitationId}/reject Decline invitation
DefaultApi DeleteInvitation Delete /organizations/{organizationId}/invitations/{invitationId} Delete invitation
DefaultApi DeleteOrganization Delete /organizations/{organizationId} Delete organization
DefaultApi DeleteRegion Delete /organizations/{organizationId}/regions/{regionId} Delete region
DefaultApi DeleteStack Delete /organizations/{organizationId}/stacks/{stackId} Delete stack
DefaultApi DeleteStackUserAccess Delete /organizations/{organizationId}/stacks/{stackId}/users/{userId} Delete stack user access role within an organization
DefaultApi DeleteUserFromOrganization Delete /organizations/{organizationId}/users/{userId} delete user from organization
DefaultApi DisableModule Delete /organizations/{organizationId}/stacks/{stackId}/modules disable module
DefaultApi DisableStack Put /organizations/{organizationId}/stacks/{stackId}/disable Disable stack
DefaultApi DisableStargate Put /organizations/{organizationId}/stacks/{stackId}/stargate/disable Disable stargate on a stack
DefaultApi EnableModule Post /organizations/{organizationId}/stacks/{stackId}/modules enable module
DefaultApi EnableStack Put /organizations/{organizationId}/stacks/{stackId}/enable Enable stack
DefaultApi EnableStargate Put /organizations/{organizationId}/stacks/{stackId}/stargate/enable Enable stargate on a stack
DefaultApi GetRegion Get /organizations/{organizationId}/regions/{regionId} Get region
DefaultApi GetRegionVersions Get /organizations/{organizationId}/regions/{regionId}/versions Get region versions
DefaultApi GetServerInfo Get /_info Get server info
DefaultApi GetStack Get /organizations/{organizationId}/stacks/{stackId} Find stack
DefaultApi ListInvitations Get /me/invitations List invitations of the user
DefaultApi ListLogs Get /organizations/{organizationId}/logs List logs
DefaultApi ListModules Get /organizations/{organizationId}/stacks/{stackId}/modules List modules of a stack
DefaultApi ListOrganizationInvitations Get /organizations/{organizationId}/invitations List invitations of the organization
DefaultApi ListOrganizations Get /organizations List organizations of the connected user
DefaultApi ListOrganizationsExpanded Get /organizations/expanded List organizations of the connected user with expanded data
DefaultApi ListRegions Get /organizations/{organizationId}/regions List regions
DefaultApi ListStackUsersAccesses Get /organizations/{organizationId}/stacks/{stackId}/users List stack users accesses within an organization
DefaultApi ListStacks Get /organizations/{organizationId}/stacks List stacks
DefaultApi ListUsersOfOrganization Get /organizations/{organizationId}/users List users of organization
DefaultApi ReadConnectedUser Get /me Read user
DefaultApi ReadOrganization Get /organizations/{organizationId} Read organization
DefaultApi ReadStackUserAccess Get /organizations/{organizationId}/stacks/{stackId}/users/{userId} Read stack user access role within an organization
DefaultApi ReadUserOfOrganization Get /organizations/{organizationId}/users/{userId} Read user of organization
DefaultApi RestoreStack Put /organizations/{organizationId}/stacks/{stackId}/restore Restore stack
DefaultApi UpdateOrganization Put /organizations/{organizationId} Update organization
DefaultApi UpdateStack Put /organizations/{organizationId}/stacks/{stackId} Update stack
DefaultApi UpgradeStack Put /organizations/{organizationId}/stacks/{stackId}/upgrade Upgrade stack
DefaultApi UpsertOrganizationUser Put /organizations/{organizationId}/users/{userId} Update user within an organization
DefaultApi UpsertStackUserAccess Put /organizations/{organizationId}/stacks/{stackId}/users/{userId} Update stack user access role within an organization

Documentation For Models

Documentation For Authorization

Authentication schemes defined for the API:

oauth2

  • Type: OAuth
  • Flow: accessCode
  • Authorization URL: /authorize
  • Scopes:
  • openid: Enable OIDC
  • email: Ask email access

Example

auth := context.WithValue(context.Background(), sw.ContextAccessToken, "ACCESSTOKENSTRING")
r, err := client.Service.Operation(auth, args)

Or via OAuth2 module to automatically refresh tokens and perform user authentication.

import "golang.org/x/oauth2"

/* Perform OAuth2 round trip request and obtain a token */

tokenSource := oauth2cfg.TokenSource(createContext(httpClient), &token)
auth := context.WithValue(oauth2.NoContext, sw.ContextOAuth2, tokenSource)
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