Skip to content

Latest commit

 

History

History
121 lines (90 loc) · 6.92 KB

File metadata and controls

121 lines (90 loc) · 6.92 KB

SchemaStore

(SchemaStore)

Overview

Available Operations

CreateSchemaStoreItem

Create a schema in the schema store

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.SchemaStore.CreateSchemaStoreItem(ctx, operations.CreateSchemaStoreItemRequestBody{
        Format: operations.FormatYaml,
        Spec: "<value>",
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.SchemaStoreItem != nil {
        // handle response
    }
}

Parameters

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

Response

*operations.CreateSchemaStoreItemResponse, error

Errors

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

GetSchemaStoreItem

Get a OAS schema from the schema store

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.SchemaStore.GetSchemaStoreItem(ctx, nil)
    if err != nil {
        log.Fatal(err)
    }
    if res.SchemaStoreItem != nil {
        // handle response
    }
}

Parameters

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

Response

*operations.GetSchemaStoreItemResponse, error

Errors

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