Categorygithub.com/stryd/shipbob-go
repositorypackage
1.2.0
Repository: https://github.com/stryd/shipbob-go.git
Documentation: pkg.go.dev

# Packages

No description provided by the author

# 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

ClassMethodHTTP requestDescription
ChannelsApiGetChannelsGet /1.0/channelGet user-authorized channel info
InventoryApiGetInventoriesGet /1.0/inventoryList inventory items
InventoryApiGetInventoryGet /1.0/inventory/{inventoryId}Get an inventory item
InventoryApiGetProductInventoriesGet /1.0/product/{productId}/inventoryGet a list of inventory items by product id
LocationsApiGetLocationsGet /1.0/locationGet locations
OrdersApiCancelOrderPost /1.0/order/{orderId}/cancelCancel single Order by Order ID
OrdersApiCancelOrderShipmentPost /1.0/order/{orderId}/shipment/{shipmentId}/cancelCancel one Shipment by Order Id and Shipment Id
OrdersApiCancelShipmentPost /1.0/shipment/{shipmentId}/cancelCancel one Shipment by Shipment Id
OrdersApiCreateOrderPost /1.0/orderCreate Order
OrdersApiCreateOrderEstimatePost /1.0/order/estimateEstimate Fulfillment Cost For Order
OrdersApiCreateOrderStoreOrderJsonPost /1.0/order/{orderId}/storeOrderJsonSave the Store Order Json
OrdersApiCreateShipmentCancelbulkPost /1.0/shipment/cancelbulkCancel multiple Shipments by Shipment Id
OrdersApiGetOrderGet /1.0/order/{orderId}Get Order
OrdersApiGetOrderShipmentGet /1.0/order/{orderId}/shipment/{shipmentId}Get one Shipment by Order Id and Shipment Id
OrdersApiGetOrderShipmentLogsGet /1.0/order/{orderId}/shipment/{shipmentId}/logsGet logs for one Shipment by Order Id and Shipment Id
OrdersApiGetOrderShipmentTimelinesGet /1.0/order/{orderId}/shipment/{shipmentId}/timelineGet one Shipment's status timeline by Order Id and Shipment Id
OrdersApiGetOrderShipmentsGet /1.0/order/{orderId}/shipmentGet all Shipments for Order
OrdersApiGetOrderStoreOrderJsonsGet /1.0/order/{orderId}/storeOrderJsonGet Order Store Json
OrdersApiGetOrdersGet /1.0/orderGet Orders
OrdersApiGetShipmentGet /1.0/shipment/{shipmentId}Get one Shipment by Shipment Id
OrdersApiGetShipmentLogsGet /1.0/shipment/{shipmentId}/logsGet logs for one Shipment by Shipment Id
OrdersApiGetShipmentTimelinesGet /1.0/shipment/{shipmentId}/timelineGet one Shipment's status timeline by Shipment Id
OrdersApiGetShippingmethodsGet /1.0/shippingmethodGet shipping methods
ProductsApiCreateProductPost /1.0/productAdd a single product to the store
ProductsApiCreateProductBatchPost /1.0/product/batchAdd multiple products to the store
ProductsApiGetProductGet /1.0/product/{productId}Get a single product
ProductsApiGetProductsGet /1.0/productGet multiple products
ProductsApiUpdateProductPut /1.0/product/{productId}Modify a single product
ReceivingApiCancelReceivingPost /1.0/receiving/{id}/cancelCancel Warehouse Receiving Order (DEPRECATED)
ReceivingApiCancelReceivingV2Post /2.0/receiving/{id}/cancelCancel Warehouse Receiving Order
ReceivingApiCreateReceivingPost /1.0/receivingCreate Warehouse Receiving Order (DEPRECATED)
ReceivingApiCreateReceivingV2Post /2.0/receivingCreate Warehouse Receiving Order
ReceivingApiGetFulfillmentCentersGet /1.0/fulfillmentCenterGet Fulfillment Centers
ReceivingApiGetReceivingGet /1.0/receiving/{id}Get Warehouse Receiving Order (DEPRECATED)
ReceivingApiGetReceivingLabelsGet /1.0/receiving/{id}/labelsGet Warehouse Receiving Order Box Labels (DEPRECATED)
ReceivingApiGetReceivingLabelsV2Get /2.0/receiving/{id}/labelsGet Warehouse Receiving Order Box Labels
ReceivingApiGetReceivingV2Get /2.0/receiving/{id}Get Warehouse Receiving Order
ReceivingApiGetReceivingsGet /1.0/receivingGet a Warehouse Receiving Order by Purchase Order Number (DEPRECATED)
ReceivingApiGetReceivingsV2Get /2.0/receivingGet Multiple Warehouse Receiving Orders
ReturnsApiCancelReturnPost /1.0/return/{id}/cancelCancel Return Order
ReturnsApiCreateReturnPost /1.0/returnCreate Return Order
ReturnsApiGetReturnGet /1.0/return/{id}Get Return Order
ReturnsApiGetReturnStatushistoryGet /1.0/return/{id}/statushistoryGet One Return's status history
ReturnsApiGetReturnsGet /1.0/returnGet Return Orders
ReturnsApiUpdateReturnPut /1.0/return/{id}Modify Return Order
WebhooksApiCreateWebhookPost /1.0/webhookCreate a new webhook subscription
WebhooksApiDeleteWebhookDelete /1.0/webhook/{id}Delete an existing webhook subscription
WebhooksApiGetWebhooksGet /1.0/webhookGet Webhooks

Documentation For Models

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

Author