(Organizations)
- Create - Create an organization
- CreateFreeTrial - Create a free trial for an organization
- Get - Get organization
- GetAll - Get organizations for a user
- GetUsage - Get billing usage summary for a particular organization
Creates an organization
package main
import(
speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3"
"github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared"
"github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/types"
"context"
"log"
)
func main() {
s := speakeasyclientsdkgo.New(
speakeasyclientsdkgo.WithSecurity(shared.Security{
APIKey: speakeasyclientsdkgo.String("<YOUR_API_KEY_HERE>"),
}),
)
ctx := context.Background()
res, err := s.Organizations.Create(ctx, shared.Organization{
AccountType: shared.AccountTypeScaleUp,
CreatedAt: types.MustTimeFromString("2023-12-01T17:06:07.804Z"),
ID: "<id>",
Name: "<value>",
Slug: "<value>",
SsoActivated: true,
TelemetryDisabled: true,
UpdatedAt: types.MustTimeFromString("2022-05-28T06:20:22.766Z"),
})
if err != nil {
log.Fatal(err)
}
if res.Organization != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
shared.Organization | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.CreateOrganizationResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.Error | 4XX | application/json |
sdkerrors.SDKError | 5XX | */* |
Creates a free trial for an organization
package main
import(
speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3"
"github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared"
"context"
"log"
)
func main() {
s := speakeasyclientsdkgo.New(
speakeasyclientsdkgo.WithSecurity(shared.Security{
APIKey: speakeasyclientsdkgo.String("<YOUR_API_KEY_HERE>"),
}),
)
ctx := context.Background()
res, err := s.Organizations.CreateFreeTrial(ctx)
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.CreateFreeTrialResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.Error | 4XX | application/json |
sdkerrors.SDKError | 5XX | */* |
Get information about a particular organization.
package main
import(
speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3"
"github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared"
"github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations"
"context"
"log"
)
func main() {
s := speakeasyclientsdkgo.New(
speakeasyclientsdkgo.WithSecurity(shared.Security{
APIKey: speakeasyclientsdkgo.String("<YOUR_API_KEY_HERE>"),
}),
)
ctx := context.Background()
res, err := s.Organizations.Get(ctx, operations.GetOrganizationRequest{
OrganizationID: "<value>",
})
if err != nil {
log.Fatal(err)
}
if res.Organization != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.GetOrganizationRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.GetOrganizationResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.Error | 4XX | application/json |
sdkerrors.SDKError | 5XX | */* |
Returns a list of organizations a user has access too
package main
import(
speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3"
"github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared"
"context"
"log"
)
func main() {
s := speakeasyclientsdkgo.New(
speakeasyclientsdkgo.WithSecurity(shared.Security{
APIKey: speakeasyclientsdkgo.String("<YOUR_API_KEY_HERE>"),
}),
)
ctx := context.Background()
res, err := s.Organizations.GetAll(ctx)
if err != nil {
log.Fatal(err)
}
if res.Organizations != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.GetOrganizationsResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.Error | 4XX | application/json |
sdkerrors.SDKError | 5XX | */* |
Returns a billing usage summary by target languages for a particular organization
package main
import(
speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3"
"github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared"
"context"
"log"
)
func main() {
s := speakeasyclientsdkgo.New(
speakeasyclientsdkgo.WithSecurity(shared.Security{
APIKey: speakeasyclientsdkgo.String("<YOUR_API_KEY_HERE>"),
}),
)
ctx := context.Background()
res, err := s.Organizations.GetUsage(ctx)
if err != nil {
log.Fatal(err)
}
if res.OrganizationUsageResponse != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.GetOrganizationUsageResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.Error | 4XX | application/json |
sdkerrors.SDKError | 5XX | */* |