# Packages
# README
Go API client for shipbob
ShipBob Developer API Documentation
Overview
This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.
- API version: 1.0
- Package version: 1.2
- Build package: org.openapitools.codegen.languages.GoClientCodegen
Installation
Install the following dependencies:
go get github.com/stretchr/testify/assert
go get golang.org/x/oauth2
go get golang.org/x/net/context
Put the package under your project folder and add the following in import:
import shipbob "github.com/stryd/shipbob-go"
To use a proxy, set the environment variable HTTP_PROXY
:
os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")
Configuration of Server URL
Default configuration comes with Servers
field that contains server objects as defined in the OpenAPI specification.
Select Server Configuration
For using other server than the one defined on index 0 set context value sw.ContextServerIndex
of type int
.
ctx := context.WithValue(context.Background(), shipbob.ContextServerIndex, 1)
Templated Server URL
Templated server URL is formatted using default variables from configuration or from context value sw.ContextServerVariables
of type map[string]string
.
ctx := context.WithValue(context.Background(), shipbob.ContextServerVariables, map[string]string{
"basePath": "v2",
})
Note, enum values are always validated and all unused variables are silently ignored.
URLs Configuration per Operation
Each operation can use different server URL defined using OperationServers
map in the Configuration
.
An operation is uniquely identified by "{classname}Service.{nickname}"
string.
Similar rules for overriding default operation server index and variables applies by using sw.ContextOperationServerIndices
and sw.ContextOperationServerVariables
context maps.
ctx := context.WithValue(context.Background(), shipbob.ContextOperationServerIndices, map[string]int{
"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), shipbob.ContextOperationServerVariables, map[string]map[string]string{
"{classname}Service.{nickname}": {
"port": "8443",
},
})
Documentation for API Endpoints
All URIs are relative to https://api.shipbob.com
Class | Method | HTTP request | Description |
---|---|---|---|
ChannelsApi | GetChannels | Get /1.0/channel | Get user-authorized channel info |
InventoryApi | GetInventories | Get /1.0/inventory | List inventory items |
InventoryApi | GetInventory | Get /1.0/inventory/{inventoryId} | Get an inventory item |
InventoryApi | GetProductInventories | Get /1.0/product/{productId}/inventory | Get a list of inventory items by product id |
LocationsApi | GetLocations | Get /1.0/location | Get locations |
OrdersApi | CancelOrder | Post /1.0/order/{orderId}/cancel | Cancel single Order by Order ID |
OrdersApi | CancelOrderShipment | Post /1.0/order/{orderId}/shipment/{shipmentId}/cancel | Cancel one Shipment by Order Id and Shipment Id |
OrdersApi | CancelShipment | Post /1.0/shipment/{shipmentId}/cancel | Cancel one Shipment by Shipment Id |
OrdersApi | CreateOrder | Post /1.0/order | Create Order |
OrdersApi | CreateOrderEstimate | Post /1.0/order/estimate | Estimate Fulfillment Cost For Order |
OrdersApi | CreateOrderStoreOrderJson | Post /1.0/order/{orderId}/storeOrderJson | Save the Store Order Json |
OrdersApi | CreateShipmentCancelbulk | Post /1.0/shipment/cancelbulk | Cancel multiple Shipments by Shipment Id |
OrdersApi | GetOrder | Get /1.0/order/{orderId} | Get Order |
OrdersApi | GetOrderShipment | Get /1.0/order/{orderId}/shipment/{shipmentId} | Get one Shipment by Order Id and Shipment Id |
OrdersApi | GetOrderShipmentLogs | Get /1.0/order/{orderId}/shipment/{shipmentId}/logs | Get logs for one Shipment by Order Id and Shipment Id |
OrdersApi | GetOrderShipmentTimelines | Get /1.0/order/{orderId}/shipment/{shipmentId}/timeline | Get one Shipment's status timeline by Order Id and Shipment Id |
OrdersApi | GetOrderShipments | Get /1.0/order/{orderId}/shipment | Get all Shipments for Order |
OrdersApi | GetOrderStoreOrderJsons | Get /1.0/order/{orderId}/storeOrderJson | Get Order Store Json |
OrdersApi | GetOrders | Get /1.0/order | Get Orders |
OrdersApi | GetShipment | Get /1.0/shipment/{shipmentId} | Get one Shipment by Shipment Id |
OrdersApi | GetShipmentLogs | Get /1.0/shipment/{shipmentId}/logs | Get logs for one Shipment by Shipment Id |
OrdersApi | GetShipmentTimelines | Get /1.0/shipment/{shipmentId}/timeline | Get one Shipment's status timeline by Shipment Id |
OrdersApi | GetShippingmethods | Get /1.0/shippingmethod | Get shipping methods |
ProductsApi | CreateProduct | Post /1.0/product | Add a single product to the store |
ProductsApi | CreateProductBatch | Post /1.0/product/batch | Add multiple products to the store |
ProductsApi | GetProduct | Get /1.0/product/{productId} | Get a single product |
ProductsApi | GetProducts | Get /1.0/product | Get multiple products |
ProductsApi | UpdateProduct | Put /1.0/product/{productId} | Modify a single product |
ReceivingApi | CancelReceiving | Post /1.0/receiving/{id}/cancel | Cancel Warehouse Receiving Order (DEPRECATED) |
ReceivingApi | CancelReceivingV2 | Post /2.0/receiving/{id}/cancel | Cancel Warehouse Receiving Order |
ReceivingApi | CreateReceiving | Post /1.0/receiving | Create Warehouse Receiving Order (DEPRECATED) |
ReceivingApi | CreateReceivingV2 | Post /2.0/receiving | Create Warehouse Receiving Order |
ReceivingApi | GetFulfillmentCenters | Get /1.0/fulfillmentCenter | Get Fulfillment Centers |
ReceivingApi | GetReceiving | Get /1.0/receiving/{id} | Get Warehouse Receiving Order (DEPRECATED) |
ReceivingApi | GetReceivingLabels | Get /1.0/receiving/{id}/labels | Get Warehouse Receiving Order Box Labels (DEPRECATED) |
ReceivingApi | GetReceivingLabelsV2 | Get /2.0/receiving/{id}/labels | Get Warehouse Receiving Order Box Labels |
ReceivingApi | GetReceivingV2 | Get /2.0/receiving/{id} | Get Warehouse Receiving Order |
ReceivingApi | GetReceivings | Get /1.0/receiving | Get a Warehouse Receiving Order by Purchase Order Number (DEPRECATED) |
ReceivingApi | GetReceivingsV2 | Get /2.0/receiving | Get Multiple Warehouse Receiving Orders |
ReturnsApi | CancelReturn | Post /1.0/return/{id}/cancel | Cancel Return Order |
ReturnsApi | CreateReturn | Post /1.0/return | Create Return Order |
ReturnsApi | GetReturn | Get /1.0/return/{id} | Get Return Order |
ReturnsApi | GetReturnStatushistory | Get /1.0/return/{id}/statushistory | Get One Return's status history |
ReturnsApi | GetReturns | Get /1.0/return | Get Return Orders |
ReturnsApi | UpdateReturn | Put /1.0/return/{id} | Modify Return Order |
WebhooksApi | CreateWebhook | Post /1.0/webhook | Create a new webhook subscription |
WebhooksApi | DeleteWebhook | Delete /1.0/webhook/{id} | Delete an existing webhook subscription |
WebhooksApi | GetWebhooks | Get /1.0/webhook | Get Webhooks |
Documentation For Models
- AddBoxItemToBox
- AddBoxToOrder
- AddProductToOrder
- AddProductToOrderByProductId
- AddProductToOrderByReferenceId
- AddStoreOrderJson
- AssignOrderToFulfillmentCenter
- Box
- BoxItem
- BoxStatus
- BundleRootInformation
- CancelShipments
- CanceledOrder
- CanceledShipment
- CanceledShipments
- Carton
- CartonDetails
- CartonMeasurements
- Channel
- ChannelInfo
- CreateOrder
- CreateProduct
- CreateReceivingOrder
- CreateReturn
- Dimension
- EstimationAddress
- FcAttribute
- FcType
- FcTypeV2
- FcTypeV2AllOf
- Financials
- FulfillmentCenter
- FulfillmentCenterRegion
- GetLocations200ResponseInner
- GetLocations200ResponseInnerOneOf
- InternalLocation
- InternalLocationAllOf
- InternalLocationAllOfFulfillmentCenterType
- InternalLocationV2
- InternalLocationV2AllOf
- InternalShipment
- Inventory
- InventoryFulfillmentCenterQuantity
- InventoryLotQuantity
- InventoryQuantityV2
- Location
- LocationAddress
- LocationService
- LocationServiceTypeEnum
- LocationV2
- LocationV2AllOf
- Order
- OrderEstimate
- OrderEstimateDetail
- OrderEstimateFulfillmentRequest
- OrderEstimateProductInfo
- OrderInventory
- OrderMeasurements
- OrderStatusDetail
- OrganizationRole
- PackageType
- PackagingAttribute
- PackingType
- ParentCarton
- ProblemDetails
- Product
- ProductActiveStatus
- ProductBundleStatus
- ProductChannel
- ProductFulfillmentCenterQuantity
- ProductInfo
- ProductInventoryItem
- ReceivingFulfillmentCenter
- ReceivingOrder
- ReceivingStatus
- Recipient
- RecipientInfo
- RetailerProgramData
- RetailerProgramDataAddress
- ReturnAction
- ReturnActionRequested
- ReturnActionSource
- ReturnActionTaken
- ReturnChannelInfo
- ReturnFulfillmentCenter
- ReturnInventory
- ReturnInventoryItem
- ReturnOrder
- ReturnOrderStatusHistory
- ReturnStatus
- ReturnTransaction
- ReturnTransactionLogSource
- ReturnType
- ServiceLevelDetail
- ShipMethodDetail
- Shipment
- ShipmentLog
- ShipmentProduct
- ShippingTerms
- SortOrder
- Tag
- Topics
- Tracking
- UpdateProduct
- ValidationProblemDetails
- ValidationProblemDetailsAllOf
- WarehouseReceivingOrderV2
- Webhook
- WebhookSubscription
Documentation For Authorization
Authentication schemes defined for the API:
oauth2
- Type: OAuth
- Flow: accessCode
- Authorization URL: https://auth.shipbob.com/connect/integrate
- Scopes:
- channels_read: Read channel metadata
- channels_write: Write channel metadata
- inventory_read: Access read operations
- inventory_write: Access write operations
- locations_read: Access locations read operations
- orders_read: Access read operations
- orders_write: Access write operations
- products_read: Access read operations
- products_write: Access write operations
- receiving_read: Access receiving read operations
- receiving_write: Access receiving write operations
- returns_read: Access returns read operations
- returns_write: Access returns write operations
- webhooks_read: Access read operations
- webhooks_write: Access write operations
Example
auth := context.WithValue(context.Background(), sw.ContextAccessToken, "ACCESSTOKENSTRING")
r, err := client.Service.Operation(auth, args)
Or via OAuth2 module to automatically refresh tokens and perform user authentication.
import "golang.org/x/oauth2"
/* Perform OAuth2 round trip request and obtain a token */
tokenSource := oauth2cfg.TokenSource(createContext(httpClient), &token)
auth := context.WithValue(oauth2.NoContext, sw.ContextOAuth2, tokenSource)
r, err := client.Service.Operation(auth, args)
pat
- Type: HTTP Bearer token authentication
Example
auth := context.WithValue(context.Background(), sw.ContextAccessToken, "BEARER_TOKEN_STRING")
r, err := client.Service.Operation(auth, args)
Documentation for Utility Methods
Due to the fact that model structure members are all pointers, this package contains a number of utility functions to easily obtain pointers to values of basic types. Each of these functions takes a value of the given basic type and returns a pointer to it:
PtrBool
PtrInt
PtrInt32
PtrInt64
PtrFloat
PtrFloat32
PtrFloat64
PtrString
PtrTime