Skip to content

Latest commit

 

History

History
467 lines (351 loc) · 21.2 KB

File metadata and controls

467 lines (351 loc) · 21.2 KB

Organizations

(Organizations)

Overview

REST APIs for managing Organizations (speakeasy L1 Tenancy construct)

Available Operations

Create

Creates an organization

Example Usage

package main

import(
	"context"
	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"
	"log"
)

func main() {
    ctx := context.Background()

    s := speakeasyclientsdkgo.New(
        speakeasyclientsdkgo.WithSecurity(shared.Security{
            APIKey: speakeasyclientsdkgo.String("<YOUR_API_KEY_HERE>"),
        }),
    )

    res, err := s.Organizations.Create(ctx, shared.Organization{
        AccountType: shared.AccountTypeScaleUp,
        CreatedAt: types.MustTimeFromString("2024-11-30T17:06:07.804Z"),
        ID: "<id>",
        Name: "<value>",
        Slug: "<value>",
        SsoActivated: true,
        TelemetryDisabled: true,
        UpdatedAt: types.MustTimeFromString("2023-03-17T15:39:20.911Z"),
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.Organization != nil {
        // handle response
    }
}

Parameters

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.

Response

*operations.CreateOrganizationResponse, error

Errors

Error Type Status Code Content Type
sdkerrors.Error 4XX application/json
sdkerrors.SDKError 5XX */*

CreateBillingAddOns

Create billing add ons

Example Usage

package main

import(
	"context"
	speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3"
	"github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared"
	"log"
)

func main() {
    ctx := context.Background()

    s := speakeasyclientsdkgo.New(
        speakeasyclientsdkgo.WithSecurity(shared.Security{
            APIKey: speakeasyclientsdkgo.String("<YOUR_API_KEY_HERE>"),
        }),
    )

    res, err := s.Organizations.CreateBillingAddOns(ctx, shared.OrganizationBillingAddOnRequest{
        AddOns: []shared.BillingAddOn{
            shared.BillingAddOnSDKTesting,
            shared.BillingAddOnSDKTesting,
            shared.BillingAddOnWebhooks,
        },
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.OrganizationBillingAddOnResponse != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
request shared.OrganizationBillingAddOnRequest ✔️ The request object to use for the request.
opts []operations.Option The options for this request.

Response

*operations.CreateBillingAddOnsResponse, error

Errors

Error Type Status Code Content Type
sdkerrors.Error 5XX application/json
sdkerrors.SDKError 4XX */*

CreateFreeTrial

Creates a free trial for an organization

Example Usage

package main

import(
	"context"
	speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3"
	"github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared"
	"log"
)

func main() {
    ctx := context.Background()

    s := speakeasyclientsdkgo.New(
        speakeasyclientsdkgo.WithSecurity(shared.Security{
            APIKey: speakeasyclientsdkgo.String("<YOUR_API_KEY_HERE>"),
        }),
    )

    res, err := s.Organizations.CreateFreeTrial(ctx)
    if err != nil {
        log.Fatal(err)
    }
    if res != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
opts []operations.Option The options for this request.

Response

*operations.CreateFreeTrialResponse, error

Errors

Error Type Status Code Content Type
sdkerrors.Error 4XX application/json
sdkerrors.SDKError 5XX */*

DeleteBillingAddOn

Delete billing add ons

Example Usage

package main

import(
	"context"
	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"
	"log"
)

func main() {
    ctx := context.Background()

    s := speakeasyclientsdkgo.New(
        speakeasyclientsdkgo.WithSecurity(shared.Security{
            APIKey: speakeasyclientsdkgo.String("<YOUR_API_KEY_HERE>"),
        }),
    )

    res, err := s.Organizations.DeleteBillingAddOn(ctx, operations.DeleteBillingAddOnRequest{
        AddOn: shared.BillingAddOnCustomCodeRegions,
    })
    if err != nil {
        log.Fatal(err)
    }
    if res != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
request operations.DeleteBillingAddOnRequest ✔️ The request object to use for the request.
opts []operations.Option The options for this request.

Response

*operations.DeleteBillingAddOnResponse, error

Errors

Error Type Status Code Content Type
sdkerrors.Error 5XX application/json
sdkerrors.SDKError 4XX */*

Get

Get information about a particular organization.

Example Usage

package main

import(
	"context"
	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"
	"log"
)

func main() {
    ctx := context.Background()

    s := speakeasyclientsdkgo.New(
        speakeasyclientsdkgo.WithSecurity(shared.Security{
            APIKey: speakeasyclientsdkgo.String("<YOUR_API_KEY_HERE>"),
        }),
    )

    res, err := s.Organizations.Get(ctx, operations.GetOrganizationRequest{
        OrganizationID: "<id>",
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.Organization != nil {
        // handle response
    }
}

Parameters

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.

Response

*operations.GetOrganizationResponse, error

Errors

Error Type Status Code Content Type
sdkerrors.Error 4XX application/json
sdkerrors.SDKError 5XX */*

GetAll

Returns a list of organizations a user has access too

Example Usage

package main

import(
	"context"
	speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3"
	"github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared"
	"log"
)

func main() {
    ctx := context.Background()

    s := speakeasyclientsdkgo.New(
        speakeasyclientsdkgo.WithSecurity(shared.Security{
            APIKey: speakeasyclientsdkgo.String("<YOUR_API_KEY_HERE>"),
        }),
    )

    res, err := s.Organizations.GetAll(ctx)
    if err != nil {
        log.Fatal(err)
    }
    if res.Organizations != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
opts []operations.Option The options for this request.

Response

*operations.GetOrganizationsResponse, error

Errors

Error Type Status Code Content Type
sdkerrors.Error 4XX application/json
sdkerrors.SDKError 5XX */*

GetBillingAddOns

Get billing add ons

Example Usage

package main

import(
	"context"
	speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3"
	"github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared"
	"log"
)

func main() {
    ctx := context.Background()

    s := speakeasyclientsdkgo.New(
        speakeasyclientsdkgo.WithSecurity(shared.Security{
            APIKey: speakeasyclientsdkgo.String("<YOUR_API_KEY_HERE>"),
        }),
    )

    res, err := s.Organizations.GetBillingAddOns(ctx)
    if err != nil {
        log.Fatal(err)
    }
    if res.OrganizationBillingAddOnResponse != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
opts []operations.Option The options for this request.

Response

*operations.GetBillingAddOnsResponse, error

Errors

Error Type Status Code Content Type
sdkerrors.Error 5XX application/json
sdkerrors.SDKError 4XX */*

GetUsage

Returns a billing usage summary by target languages for a particular organization

Example Usage

package main

import(
	"context"
	speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3"
	"github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared"
	"log"
)

func main() {
    ctx := context.Background()

    s := speakeasyclientsdkgo.New(
        speakeasyclientsdkgo.WithSecurity(shared.Security{
            APIKey: speakeasyclientsdkgo.String("<YOUR_API_KEY_HERE>"),
        }),
    )

    res, err := s.Organizations.GetUsage(ctx)
    if err != nil {
        log.Fatal(err)
    }
    if res.OrganizationUsageResponse != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
opts []operations.Option The options for this request.

Response

*operations.GetOrganizationUsageResponse, error

Errors

Error Type Status Code Content Type
sdkerrors.Error 4XX application/json
sdkerrors.SDKError 5XX */*