Documentation ¶
Overview ¶
Package `organizations` provides a client wrapping the WorkOS Organizations API.
Index ¶
- Constants
- Variables
- func DeleteOrganization(ctx context.Context, opts DeleteOrganizationOpts) error
- func SetAPIKey(apiKey string)
- type Client
- func (c *Client) CreateOrganization(ctx context.Context, opts CreateOrganizationOpts) (Organization, error)
- func (c *Client) DeleteOrganization(ctx context.Context, opts DeleteOrganizationOpts) error
- func (c *Client) GetOrganization(ctx context.Context, opts GetOrganizationOpts) (Organization, error)
- func (c *Client) ListOrganizations(ctx context.Context, opts ListOrganizationsOpts) (ListOrganizationsResponse, error)
- func (c *Client) UpdateOrganization(ctx context.Context, opts UpdateOrganizationOpts) (Organization, error)
- type CreateOrganizationOpts
- type DeleteOrganizationOpts
- type GetOrganizationOpts
- type ListOrganizationsOpts
- type ListOrganizationsResponse
- type Order
- type Organization
- type OrganizationDomain
- type UpdateOrganizationOpts
Constants ¶
const ResponseLimit = 10
ResponseLimit is the default number of records to limit a response to.
Variables ¶
var (
DefaultClient = &Client{
Endpoint: "https://api.workos.com",
}
)
DefaultClient is the client used by SetAPIKey and Organizations functions.
Functions ¶
func DeleteOrganization ¶
func DeleteOrganization( ctx context.Context, opts DeleteOrganizationOpts, ) error
DeleteOrganization deletes an Organization.
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 Organization 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 Organization requests to the WorkOS API.
func (*Client) CreateOrganization ¶
func (c *Client) CreateOrganization(ctx context.Context, opts CreateOrganizationOpts) (Organization, error)
CreateOrganization creates an Organization.
func (*Client) DeleteOrganization ¶
func (c *Client) DeleteOrganization( ctx context.Context, opts DeleteOrganizationOpts, ) error
DeleteOrganization deletes an Organization.
func (*Client) GetOrganization ¶
func (c *Client) GetOrganization( ctx context.Context, opts GetOrganizationOpts, ) (Organization, error)
GetOrganization gets an Organization.
func (*Client) ListOrganizations ¶
func (c *Client) ListOrganizations( ctx context.Context, opts ListOrganizationsOpts, ) (ListOrganizationsResponse, error)
ListOrganizations gets a list of WorkOS Organizations.
func (*Client) UpdateOrganization ¶
func (c *Client) UpdateOrganization(ctx context.Context, opts UpdateOrganizationOpts) (Organization, error)
UpdateOrganization updates an Organization.
type CreateOrganizationOpts ¶
type CreateOrganizationOpts struct { // Name of the Organization. Name string `json:"name"` // Whether Connections within the Organization allow profiles that are // outside of the Organization's configured User Email Domains. AllowProfilesOutsideOrganization bool `json:"allow_profiles_outside_organization"` // Domains of the Organization. Domains []string `json:"domains"` // Optional unique identifier to ensure idempotency IdempotencyKey string `json:"idempotency_iey,omitempty"` }
CreateOrganizationOpts contains the options to create an Organization.
type DeleteOrganizationOpts ¶
type DeleteOrganizationOpts struct { // Organization unique identifier. Organization string }
DeleteOrganizationOpts contains the options to delete an Organization.
type GetOrganizationOpts ¶
type GetOrganizationOpts struct { // Organization unique identifier. Organization string }
GetOrganizationOpts contains the options to request details for an Organization.
type ListOrganizationsOpts ¶
type ListOrganizationsOpts struct { // Domains of the Organization. Domains []string `url:"domains,brackets,omitempty"` // Maximum number of records to return. Limit int `url:"limit,omitempty"` // The order in which to paginate records. Order Order `url:"order,omitempty"` // Pagination cursor to receive records before a provided Organization ID. Before string `url:"before,omitempty"` // Pagination cursor to receive records after a provided Organization ID. After string `url:"after,omitempty"` }
ListOrganizationsOpts contains the options to request Organizations.
type ListOrganizationsResponse ¶
type ListOrganizationsResponse struct { // List of provisioned Organizations. Data []Organization `json:"data"` // Cursor pagination options. ListMetadata common.ListMetadata `json:"listMetadata"` }
ListOrganizationsResponse describes the response structure when requesting Organizations
func ListOrganizations ¶
func ListOrganizations( ctx context.Context, opts ListOrganizationsOpts, ) (ListOrganizationsResponse, error)
ListOrganizations gets a list of Organizations.
type Organization ¶
type Organization struct { // The Organization's unique identifier. ID string `json:"id"` // The Organization's name. Name string `json:"name"` // Whether Connections within the Organization allow profiles that are // outside of the Organization's configured User Email Domains. AllowProfilesOutsideOrganization bool `json:"allow_profiles_outside_organization"` // The Organization's Domains. Domains []OrganizationDomain `json:"domains"` // The timestamp of when the Organization was created. CreatedAt string `json:"created_at"` // The timestamp of when the Organization was updated. UpdatedAt string `json:"updated_at"` }
Organization contains data about a WorkOS Organization.
func CreateOrganization ¶
func CreateOrganization( ctx context.Context, opts CreateOrganizationOpts, ) (Organization, error)
CreateOrganization creates an Organization.
func GetOrganization ¶
func GetOrganization( ctx context.Context, opts GetOrganizationOpts, ) (Organization, error)
GetOrganization gets an Organization.
func UpdateOrganization ¶
func UpdateOrganization( ctx context.Context, opts UpdateOrganizationOpts, ) (Organization, error)
UpdateOrganization creates an Organization.
type OrganizationDomain ¶
type OrganizationDomain struct { // The Organization Domain's unique identifier. ID string `json:"id"` // The domain value Domain string `json:"domain"` }
OrganizationDomain contains data about an Organization's Domains.
type UpdateOrganizationOpts ¶
type UpdateOrganizationOpts struct { // Organization unique identifier. Organization string // Name of the Organization. Name string // Whether Connections within the Organization allow profiles that are // outside of the Organization's configured User Email Domains. AllowProfilesOutsideOrganization bool // Domains of the Organization. Domains []string }
UpdateOrganizationOpts contains the options to update an Organization.