(Events)
REST APIs for managing events captured by a speakeasy binary (CLI, GitHub Action etc)
- GetEventsByTarget - Load recent events for a particular workspace
- GetTargets - Load targets for a particular workspace
- GetTargetsDeprecated - Load targets for a particular workspace
- Post - Post events for a specific workspace
- Search - Search events for a particular workspace by any field
Load recent events for a particular workspace
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.Events.GetEventsByTarget(ctx, operations.GetWorkspaceEventsByTargetRequest{
TargetID: "<id>",
})
if err != nil {
log.Fatal(err)
}
if res.CliEventBatch != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.GetWorkspaceEventsByTargetRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.GetWorkspaceEventsByTargetResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.Error | 5XX | application/json |
sdkerrors.SDKError | 4XX | */* |
Load targets for a particular workspace
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.Events.GetTargets(ctx, operations.GetWorkspaceTargetsRequest{})
if err != nil {
log.Fatal(err)
}
if res.TargetSDKList != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.GetWorkspaceTargetsRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.GetWorkspaceTargetsResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.Error | 5XX | application/json |
sdkerrors.SDKError | 4XX | */* |
Load targets for a particular workspace
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.Events.GetTargetsDeprecated(ctx, operations.GetWorkspaceTargetsDeprecatedRequest{})
if err != nil {
log.Fatal(err)
}
if res.TargetSDKList != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.GetWorkspaceTargetsDeprecatedRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.GetWorkspaceTargetsDeprecatedResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.Error | 5XX | application/json |
sdkerrors.SDKError | 4XX | */* |
Sends an array of events to be stored for a particular workspace.
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"
"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.Events.Post(ctx, operations.PostWorkspaceEventsRequest{
RequestBody: []shared.CliEvent{
shared.CliEvent{
CreatedAt: types.MustTimeFromString("2024-08-12T17:54:17.538Z"),
ExecutionID: "<id>",
ID: "<id>",
InteractionType: shared.InteractionTypeCiExec,
LocalStartedAt: types.MustTimeFromString("2023-11-23T06:26:30.993Z"),
SpeakeasyAPIKeyName: "<value>",
SpeakeasyVersion: "<value>",
Success: false,
WorkspaceID: "<id>",
},
},
})
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. |
request |
operations.PostWorkspaceEventsRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.PostWorkspaceEventsResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.Error | 5XX | application/json |
sdkerrors.SDKError | 4XX | */* |
Search events for a particular workspace by any field
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.Events.Search(ctx, operations.SearchWorkspaceEventsRequest{})
if err != nil {
log.Fatal(err)
}
if res.CliEventBatch != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.SearchWorkspaceEventsRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.SearchWorkspaceEventsResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.Error | 5XX | application/json |
sdkerrors.SDKError | 4XX | */* |