(Subscriptions)
REST APIs for managing subscriptions
- CreateSubscription - Create Subscription
- ListRegistrySubscriptions - List Subscriptions
Create Subscription
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
}
}
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. |
*operations.CreateSubscriptionResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.SDKError | 4XX, 5XX | */* |
List Subscriptions
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
}
}
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. |
*operations.ListRegistrySubscriptionsResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.SDKError | 4XX, 5XX | */* |