forked from workos/workos-go
/
portal.go
42 lines (36 loc) · 1019 Bytes
/
portal.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Package `portal` provides a client wrapping the WorkOS Admin Portal API.
package portal
import (
"context"
)
// DefaultClient is the client used by SetAPIKey and Admin Portal functions.
var (
DefaultClient = &Client{
Endpoint: "https://api.workos.com",
}
)
// SetAPIKey sets the WorkOS API key for Admin Portal requests.
func SetAPIKey(apiKey string) {
DefaultClient.APIKey = apiKey
}
// ListOrganizations gets a list of Organizations.
func ListOrganizations(
ctx context.Context,
opts ListOrganizationsOpts,
) (ListOrganizationsResponse, error) {
return DefaultClient.ListOrganizations(ctx, opts)
}
// CreateOrganization creates an Organization.
func CreateOrganization(
ctx context.Context,
opts CreateOrganizationOpts,
) (Organization, error) {
return DefaultClient.CreateOrganization(ctx, opts)
}
// GenerateLink generates an ephemeral link to the Admin Portal
func GenerateLink(
ctx context.Context,
opts GenerateLinkOpts,
) (string, error) {
return DefaultClient.GenerateLink(ctx, opts)
}