Skip to content

Latest commit

 

History

History
129 lines (99 loc) · 7.2 KB

File metadata and controls

129 lines (99 loc) · 7.2 KB

Subscriptions

(Subscriptions)

Overview

REST APIs for managing subscriptions

Available Operations

CreateSubscription

Create Subscription

Example Usage

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"
	"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.Subscriptions.CreateSubscription(ctx, operations.CreateSubscriptionRequest{
        RegistrySubscription: shared.RegistrySubscription{
            CreatedAt: types.MustTimeFromString("2022-06-08T17:58:57.702Z"),
            EventType: shared.EventTypeUpdate,
            ID: "<id>",
            NamespaceName: "<value>",
            SubscriptionSettings: "<value>",
            SubscriptionType: shared.SubscriptionTypeCli,
            UpdatedAt: types.MustTimeFromString("2022-07-20T08:51:35.776Z"),
            WorkspaceID: "<id>",
        },
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.RegistrySubscription != nil {
        // handle response
    }
}

Parameters

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

Response

*operations.CreateSubscriptionResponse, error

Errors

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

ListRegistrySubscriptions

List Subscriptions

Example Usage

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.Subscriptions.ListRegistrySubscriptions(ctx, operations.ListRegistrySubscriptionsRequest{})
    if err != nil {
        log.Fatal(err)
    }
    if res.Classes != nil {
        // handle response
    }
}

Parameters

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

Response

*operations.ListRegistrySubscriptionsResponse, error

Errors

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