(Store)
Access to Petstore orders
Find out more about our store http://swagger.io
- DeleteOrder - Delete purchase order by ID
- GetInventory - Returns pet inventories by status
- GetOrderByID - Find purchase order by ID
- PlaceOrderForm - Place an order for a pet
- PlaceOrderJSON - Place an order for a pet
- PlaceOrderRaw - Place an order for a pet
For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
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
}
}
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. |
*operations.DeleteOrderResponse, error
Error Object | Status Code | Content Type |
---|---|---|
sdkerrors.SDKError | 4xx-5xx | / |
Returns a map of status codes to quantities
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
}
}
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. |
*operations.GetInventoryResponse, error
Error Object | Status Code | Content Type |
---|---|---|
sdkerrors.SDKError | 4xx-5xx | / |
For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions.
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
}
}
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. |
*operations.GetOrderByIDResponse, error
Error Object | Status Code | Content Type |
---|---|---|
sdkerrors.SDKError | 4xx-5xx | / |
Place a new order in the store
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
}
}
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. |
*operations.PlaceOrderFormResponse, error
Error Object | Status Code | Content Type |
---|---|---|
sdkerrors.SDKError | 4xx-5xx | / |
Place a new order in the store
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
}
}
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. |
*operations.PlaceOrderJSONResponse, error
Error Object | Status Code | Content Type |
---|---|---|
sdkerrors.SDKError | 4xx-5xx | / |
Place a new order in the store
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
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
[]byte | ✔️ | The request object to use for the request. |
*operations.PlaceOrderRawResponse, error
Error Object | Status Code | Content Type |
---|---|---|
sdkerrors.SDKError | 4xx-5xx | / |