Skip to content

Latest commit

 

History

History
180 lines (137 loc) · 10.7 KB

File metadata and controls

180 lines (137 loc) · 10.7 KB

Requests

(Requests)

Overview

REST APIs for retrieving request information

Available Operations

GenerateRequestPostmanCollection

Generates a Postman collection for a particular request. Allowing it to be replayed with the same inputs that were captured by the SDK.

Example Usage

package main

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

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

    ctx := context.Background()
    res, err := s.Requests.GenerateRequestPostmanCollection(ctx, operations.GenerateRequestPostmanCollectionRequest{
        RequestID: "<value>",
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.PostmanCollection != nil {
        // handle response
    }
}

Parameters

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

Response

*operations.GenerateRequestPostmanCollectionResponse, error

Errors

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

GetRequestFromEventLog

Get information about a particular request.

Example Usage

package main

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

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

    ctx := context.Background()
    res, err := s.Requests.GetRequestFromEventLog(ctx, operations.GetRequestFromEventLogRequest{
        RequestID: "<value>",
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.UnboundedRequest != nil {
        // handle response
    }
}

Parameters

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

Response

*operations.GetRequestFromEventLogResponse, error

Errors

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

QueryEventLog

Supports retrieving a list of request captured by the SDK for this workspace. Allows the filtering of requests on a number of criteria such as ApiID, VersionID, Path, Method, etc.

Example Usage

package main

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

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

    ctx := context.Background()
    res, err := s.Requests.QueryEventLog(ctx, operations.QueryEventLogRequest{})
    if err != nil {
        log.Fatal(err)
    }
    if res.BoundedRequests != nil {
        // handle response
    }
}

Parameters

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

Response

*operations.QueryEventLogResponse, error

Errors

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