Skip to content

Latest commit

 

History

History
318 lines (240 loc) · 13.1 KB

README.md

File metadata and controls

318 lines (240 loc) · 13.1 KB

Store

(Store)

Overview

Access to Petstore orders

Find out more about our store http://swagger.io

Available Operations

DeleteOrder

For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors

Example Usage

package main

import(
	"github.com/speakeasy-sdks/golx_pets/pkg/models/shared"
	golxpets "github.com/speakeasy-sdks/golx_pets"
	"context"
	"github.com/speakeasy-sdks/golx_pets/pkg/models/operations"
	"log"
)

func main() {
    s := golxpets.New(
        golxpets.WithSecurity("Bearer <YOUR_ACCESS_TOKEN_HERE>"),
    )

    ctx := context.Background()
    res, err := s.Store.DeleteOrder(ctx, operations.DeleteOrderRequest{
        OrderID: 127902,
    })
    if err != nil {
        log.Fatal(err)
    }
    if res != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
request operations.DeleteOrderRequest ✔️ The request object to use for the request.

Response

*operations.DeleteOrderResponse, error

Error Object Status Code Content Type
sdkerrors.SDKError 4xx-5xx /

GetInventory

Returns a map of status codes to quantities

Example Usage

package main

import(
	golxpets "github.com/speakeasy-sdks/golx_pets"
	"github.com/speakeasy-sdks/golx_pets/pkg/models/operations"
	"context"
	"log"
)

func main() {
    s := golxpets.New()


    operationSecurity := operations.GetInventorySecurity{
            APIKey: "<YOUR_API_KEY_HERE>",
        }

    ctx := context.Background()
    res, err := s.Store.GetInventory(ctx, operationSecurity)
    if err != nil {
        log.Fatal(err)
    }
    if res.Object != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
security operations.GetInventorySecurity ✔️ The security requirements to use for the request.

Response

*operations.GetInventoryResponse, error

Error Object Status Code Content Type
sdkerrors.SDKError 4xx-5xx /

GetOrderByID

For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions.

Example Usage

package main

import(
	"github.com/speakeasy-sdks/golx_pets/pkg/models/shared"
	golxpets "github.com/speakeasy-sdks/golx_pets"
	"context"
	"github.com/speakeasy-sdks/golx_pets/pkg/models/operations"
	"log"
)

func main() {
    s := golxpets.New(
        golxpets.WithSecurity("Bearer <YOUR_ACCESS_TOKEN_HERE>"),
    )

    ctx := context.Background()
    res, err := s.Store.GetOrderByID(ctx, operations.GetOrderByIDRequest{
        OrderID: 614993,
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.Order != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
request operations.GetOrderByIDRequest ✔️ The request object to use for the request.

Response

*operations.GetOrderByIDResponse, error

Error Object Status Code Content Type
sdkerrors.SDKError 4xx-5xx /

PlaceOrderForm

Place a new order in the store

Example Usage

package main

import(
	"github.com/speakeasy-sdks/golx_pets/pkg/models/shared"
	golxpets "github.com/speakeasy-sdks/golx_pets"
	"context"
	"log"
)

func main() {
    s := golxpets.New(
        golxpets.WithSecurity("Bearer <YOUR_ACCESS_TOKEN_HERE>"),
    )

    ctx := context.Background()
    res, err := s.Store.PlaceOrderForm(ctx, &shared.Order{
        ID: golxpets.Int64(10),
        PetID: golxpets.Int64(198772),
        Quantity: golxpets.Int(7),
        Status: shared.StatusApproved.ToPointer(),
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.Order != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
request shared.Order ✔️ The request object to use for the request.

Response

*operations.PlaceOrderFormResponse, error

Error Object Status Code Content Type
sdkerrors.SDKError 4xx-5xx /

PlaceOrderJSON

Place a new order in the store

Example Usage

package main

import(
	"github.com/speakeasy-sdks/golx_pets/pkg/models/shared"
	golxpets "github.com/speakeasy-sdks/golx_pets"
	"context"
	"log"
)

func main() {
    s := golxpets.New(
        golxpets.WithSecurity("Bearer <YOUR_ACCESS_TOKEN_HERE>"),
    )

    ctx := context.Background()
    res, err := s.Store.PlaceOrderJSON(ctx, &shared.Order{
        ID: golxpets.Int64(10),
        PetID: golxpets.Int64(198772),
        Quantity: golxpets.Int(7),
        Status: shared.StatusApproved.ToPointer(),
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.Order != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
request shared.Order ✔️ The request object to use for the request.

Response

*operations.PlaceOrderJSONResponse, error

Error Object Status Code Content Type
sdkerrors.SDKError 4xx-5xx /

PlaceOrderRaw

Place a new order in the store

Example Usage

package main

import(
	"github.com/speakeasy-sdks/golx_pets/pkg/models/shared"
	golxpets "github.com/speakeasy-sdks/golx_pets"
	"context"
	"log"
)

func main() {
    s := golxpets.New(
        golxpets.WithSecurity("Bearer <YOUR_ACCESS_TOKEN_HERE>"),
    )

    ctx := context.Background()
    res, err := s.Store.PlaceOrderRaw(ctx, []byte("0xcB9dC14dEe"))
    if err != nil {
        log.Fatal(err)
    }
    if res.Order != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
request []byte ✔️ The request object to use for the request.

Response

*operations.PlaceOrderRawResponse, error

Error Object Status Code Content Type
sdkerrors.SDKError 4xx-5xx /