-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathwidgets.go
More file actions
33 lines (28 loc) · 1.08 KB
/
widgets.go
File metadata and controls
33 lines (28 loc) · 1.08 KB
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
// Code generated by oagen. DO NOT EDIT.
package workos
import (
"context"
)
// WidgetService handles Widgets operations.
type WidgetService struct {
client *Client
}
// WidgetsCreateTokenParams contains the parameters for CreateToken.
type WidgetsCreateTokenParams struct {
// OrganizationID is the ID of the organization to scope the widget session to.
OrganizationID string `json:"organization_id"`
// UserID is the ID of the user to issue the widget session token for.
UserID *string `json:"user_id,omitempty"`
// Scopes is the scopes to grant the widget session.
Scopes []WidgetSessionTokenScopes `json:"scopes,omitempty"`
}
// CreateToken generate a widget token
// Generate a widget token scoped to an organization and user with the specified scopes.
func (s *WidgetService) CreateToken(ctx context.Context, params *WidgetsCreateTokenParams, opts ...RequestOption) (*WidgetSessionTokenResponse, error) {
var result WidgetSessionTokenResponse
_, err := s.client.request(ctx, "POST", "/widgets/token", nil, params, &result, opts)
if err != nil {
return nil, err
}
return &result, nil
}