portal

package
v1.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 15, 2022 License: MIT Imports: 8 Imported by: 0

README

portal

Go Report Card

A Go package to make requests to the WorkOS Admin Portal API.

Install

go get -u github.com/gosdktest/workos-go/pkg/portal

How it works

See the Admin Portal integration guide.

Documentation

Overview

Package `portal` provides a client wrapping the WorkOS Admin Portal API.

Index

Constants

View Source
const ResponseLimit = 10

ResponseLimit is the default number of records to limit a response to.

Variables

View Source
var (
	DefaultClient = &Client{
		Endpoint: "https://api.workos.com",
	}
)

DefaultClient is the client used by SetAPIKey and Admin Portal functions.

Functions

func GenerateLink(
	ctx context.Context,
	opts GenerateLinkOpts,
) (string, error)

GenerateLink generates an ephemeral link to the Admin Portal

func SetAPIKey

func SetAPIKey(apiKey string)

SetAPIKey sets the WorkOS API key for Admin Portal requests.

Types

type Client

type Client struct {
	// The WorkOS API Key. It can be found in https://dashboard.workos.com/api-keys.
	APIKey string

	// The http.Client that is used to manage Admin Portal records from WorkOS.
	// Defaults to http.Client.
	HTTPClient *http.Client

	// The endpoint to WorkOS API. Defaults to https://api.workos.com.
	Endpoint string

	// The function used to encode in JSON. Defaults to json.Marshal.
	JSONEncode func(v interface{}) ([]byte, error)
	// contains filtered or unexported fields
}

Client represents a client that performs Admin Portal requests to the WorkOS API.

func (c *Client) GenerateLink(
	ctx context.Context,
	opts GenerateLinkOpts,
) (string, error)

GenerateLink generates a link to the Admin Portal

type GenerateLinkIntent

type GenerateLinkIntent string

GenerateLinkIntent represents the intent of an Admin Portal.

const (
	SSO   GenerateLinkIntent = "sso"
	DSync GenerateLinkIntent = "dsync"
)

Constants that enumerate the available GenerateLinkIntent types.

type GenerateLinkOpts

type GenerateLinkOpts struct {
	// Intent of the Admin Portal
	Intent GenerateLinkIntent `json:"intent"`

	// Organization identifier to scope the Portal Session
	Organization string `json:"organization"`

	// The URL to which users will return to when finished with the Admin Portal.
	ReturnURL string `json:"return_url"`
}

GenerateLinkOpts contains the options to request Organizations.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL