speakeasyclientsdkgo

package module
v1.29.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 21, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

README

github.com/speakeasy-api/speakeasy-client-sdk-go

SDK Installation

go get github.com/speakeasy-api/speakeasy-client-sdk-go

SDK Example Usage

package main

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

func main() {
	s := speakeasyclientsdkgo.New(
		speakeasyclientsdkgo.WithSecurity(""),
	)

	ctx := context.Background()
	res, err := s.Apis.GetApis(ctx, operations.GetApisRequest{
		Metadata: map[string][]string{
			"key": []string{
				"string",
			},
		},
		Op: &operations.GetApisOp{
			And: false,
		},
	})
	if err != nil {
		log.Fatal(err)
	}

	if res.Apis != nil {
		// handle response
	}
}

Available Resources and Operations

Speakeasy SDK
APIEndpoints
Apis
Embeds
Metadata
Plugins
Requests
Schemas

Dev Containers

Experience our SDK in an enhanced sandbox environment. Try it now in GitHub Codespaces!

Pagination

Some of the endpoints in this SDK support pagination. To use pagination, you make your SDK calls as usual, but the returned response object will have a Next method that can be called to pull down the next group of results. If the return value of Next is nil, then there are no more pages to be fetched.

Here's an example of one such pagination call:

SDK Generated by Speakeasy

Documentation

Index

Constants

View Source
const (
	ServerProd string = "prod"
)

Variables

View Source
var ServerList = map[string]string{
	ServerProd: "https://api.prod.speakeasyapi.dev",
}

ServerList contains the list of servers available to the SDK

Functions

func Bool

func Bool(b bool) *bool

Bool provides a helper function to return a pointer to a bool

func Float32

func Float32(f float32) *float32

Float32 provides a helper function to return a pointer to a float32

func Float64

func Float64(f float64) *float64

Float64 provides a helper function to return a pointer to a float64

func Int

func Int(i int) *int

Int provides a helper function to return a pointer to an int

func Int64

func Int64(i int64) *int64

Int64 provides a helper function to return a pointer to an int64

func String

func String(s string) *string

String provides a helper function to return a pointer to a string

Types

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

HTTPClient provides an interface for suplying the SDK with a custom HTTP client

type SDKOption

type SDKOption func(*Speakeasy)

func WithClient

func WithClient(client HTTPClient) SDKOption

WithClient allows the overriding of the default HTTP client used by the SDK

func WithRetryConfig added in v1.27.0

func WithRetryConfig(retryConfig utils.RetryConfig) SDKOption

func WithSecurity

func WithSecurity(apiKey string) SDKOption

func WithServer

func WithServer(server string) SDKOption

WithServer allows the overriding of the default server by name

func WithServerURL

func WithServerURL(serverURL string) SDKOption

WithServerURL allows the overriding of the default server URL

func WithTemplatedServerURL

func WithTemplatedServerURL(serverURL string, params map[string]string) SDKOption

WithTemplatedServerURL allows the overriding of the default server URL with a templated URL populated with the provided parameters

type Speakeasy

type Speakeasy struct {
	// REST APIs for managing ApiEndpoint entities
	APIEndpoints *apiEndpoints
	// REST APIs for managing Api entities
	Apis *apis
	// REST APIs for managing embeds
	Embeds *embeds
	// REST APIs for managing Version Metadata entities
	Metadata *metadata
	// REST APIs for managing and running plugins
	Plugins *plugins
	// REST APIs for retrieving request information
	Requests *requests
	// REST APIs for managing Schema entities
	Schemas *schemas
	// contains filtered or unexported fields
}

Speakeasy API: The Speakeasy API allows teams to manage common operations with their APIs

/docs - The Speakeasy Platform Documentation

func New

func New(opts ...SDKOption) *Speakeasy

New creates a new instance of the SDK with the provided options

func (*Speakeasy) ValidateAPIKey

func (s *Speakeasy) ValidateAPIKey(ctx context.Context) (*operations.ValidateAPIKeyResponse, error)

ValidateAPIKey - Validate the current api key.

Directories

Path Synopsis
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL