### Install Zippendo Go SDK Source: https://github.com/zippendo/zippendo-go/blob/main/README.md Install the official Go client for the Zippendo shipping & logistics API using the go get command. Requires Go 1.23+. ```sh go get github.com/zippendo/zippendo-go ``` -------------------------------- ### ListOrderChannels Go Example Source: https://github.com/zippendo/zippendo-go/blob/main/docs/OrderChannelsAPI.md Example of calling the ListOrderChannels API to list order channels with optional filters. The example sets up the API client and executes the request, printing the response or error. Note the brandScope parameter behavior: 'shared' returns no rows for brand-owned records in a brand context. ```go package main import ( "context" "fmt" "os" openapiclient "github.com/zippendo/zippendo-go" ) func main() { orgId := "org_8f3kd92ld0" // string | Organization ID page := int32(1) // int32 | Page number (1-based) (optional) (default to 1) limit := int32(20) // int32 | Items per page (max 100) (optional) (default to 20) brandId := "brnd_8f3kd92ld0" // string | Filter by brand. Pass a brand ID, or \"none\" for records not assigned to any brand. (optional) brandScope := "own" // string | How the brand context narrows this list: \"own\" returns only rows assigned to the current brand (requires a brand session, a brand-bound token, or the X-Zippendo-Brand header), \"shared\" returns only unassigned organization-wide rows, \"both\" (default) returns both. The X-Zippendo-Brand-Scope header supplies a default when the parameter is omitted. For strictly brand-owned records (orders, shipments), a brand-scoped request combined with \"shared\" returns no rows, since those records are never visible organization-wide from within a brand context. (optional) type_ := "shopify" // string | Filter by channel type. (optional) enabled := "true" // string | Filter by enabled state. (optional) search := "Anna's Shopify Store" // string | Search by channel name. (optional) configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.OrderChannelsAPI.ListOrderChannels(context.Background(), orgId).Page(page).Limit(limit).BrandId(brandId).BrandScope(brandScope).Type_(type_).Enabled(enabled).Search(search).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `OrderChannelsAPI.ListOrderChannels``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `ListOrderChannels`: ListOrderChannels200Response fmt.Fprintf(os.Stdout, "Response from `OrderChannelsAPI.ListOrderChannels`: %v\n", resp) } ``` -------------------------------- ### CreateOrderChannel example Source: https://github.com/zippendo/zippendo-go/blob/main/docs/OrderChannelsAPI.md Example of creating an order channel using the OrderChannelsAPI. Requires an organization ID and a CreateOrderChannelRequest object. The response is a ListOrderChannels200ResponseDataInner object. ```go package main import ( "context" "fmt" "os" openapiclient "github.com/zippendo/zippendo-go" ) func main() { orgId := "org_8f3kd92ld0" // string | Organization ID createOrderChannelRequest := *openapiclient.NewCreateOrderChannelRequest("Anna's webshop", "custom") // CreateOrderChannelRequest | configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.OrderChannelsAPI.CreateOrderChannel(context.Background(), orgId).CreateOrderChannelRequest(createOrderChannelRequest).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `OrderChannelsAPI.CreateOrderChannel``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `CreateOrderChannel`: ListOrderChannels200ResponseDataInner fmt.Fprintf(os.Stdout, "Response from `OrderChannelsAPI.CreateOrderChannel`: %v\n", resp) } ``` -------------------------------- ### CreateAddress example Source: https://github.com/zippendo/zippendo-go/blob/main/docs/AddressesAPI.md Example of calling the CreateAddress endpoint to create an address. Requires an organization ID and a CreateAddressRequest object. The response is a ListAddresses200ResponseDataInner object. ```go package main import ( "context" "fmt" "os" openapiclient "github.com/zippendo/zippendo-go" ) func main() { orgId := "org_01HZX9K2QF" // string | Organization ID createAddressRequest := *openapiclient.NewCreateAddressRequest("Zippendo ApS", "Vesterbrogade 1", "1620", "København", "+4533123456", "DK", "lager@example.dk") // CreateAddressRequest | configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.AddressesAPI.CreateAddress(context.Background(), orgId).CreateAddressRequest(createAddressRequest).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `AddressesAPI.CreateAddress``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `CreateAddress`: ListAddresses200ResponseDataInner fmt.Fprintf(os.Stdout, "Response from `AddressesAPI.CreateAddress`: %v\n", resp) } ``` -------------------------------- ### CreateOrder example in Go Source: https://github.com/zippendo/zippendo-go/blob/main/docs/OrdersAPI.md Example of calling the CreateOrder endpoint to create an order. It requires an organization ID and a CreateOrderRequest with order number, customer ID, and order lines. The response is a CreateOrder201Response. ```go package main import ( "context" "fmt" "os" openapiclient "github.com/zippendo/zippendo-go" ) func main() { orgId := "org_8f3kd92ld0" // string | Organization ID createOrderRequest := *openapiclient.NewCreateOrderRequest("#1042", "clz9k2f0a0001abcd1234efgh", []openapiclient.CreateOrderRequestOrderLinesInner{*openapiclient.NewCreateOrderRequestOrderLinesInner("Wool Sweater", int32(2))}) // CreateOrderRequest | configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.OrdersAPI.CreateOrder(context.Background(), orgId).CreateOrderRequest(createOrderRequest).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `OrdersAPI.CreateOrder``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `CreateOrder`: CreateOrder201Response fmt.Fprintf(os.Stdout, "Response from `OrdersAPI.CreateOrder`: %v\n", resp) } ``` -------------------------------- ### ListShippingRules Go example Source: https://github.com/zippendo/zippendo-go/blob/main/docs/RulesAPI.md Lists shipping rules for an organization. The example sets optional parameters for pagination, brand filtering, carrier filtering, and search. Requires an organization ID and uses bearerAuth. ```go package main import ( "context" "fmt" "os" openapiclient "github.com/zippendo/zippendo-go" ) func main() { orgId := "org_01HZX9K2QF" // string | Organization ID page := int32(1) // int32 | Page number (1-based) (optional) (default to 1) limit := int32(20) // int32 | Items per page (max 100) (optional) (default to 20) brandId := "brnd_8f3kd92ld0" // string | Filter by brand. Pass a brand ID, or \"none\" for records not assigned to any brand. (optional) brandScope := "own" // string | How the brand context narrows this list: \"own\" returns only rows assigned to the current brand (requires a brand session, a brand-bound token, or the X-Zippendo-Brand header), \"shared\" returns only unassigned organization-wide rows, \"both\" (default) returns both. The X-Zippendo-Brand-Scope header supplies a default when the parameter is omitted. For strictly brand-owned records (orders, shipments), a brand-scoped request combined with \"shared\" returns no rows, since those records are never visible organization-wide from within a brand context. (optional) carrierId := "carr_01HZX9K2QF" // string | Filter by carrier. (optional) search := "Home delivery" // string | Search by rule name. (optional) configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.RulesAPI.ListShippingRules(context.Background(), orgId).Page(page).Limit(limit).BrandId(brandId).BrandScope(brandScope).CarrierId(carrierId).Search(search).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `RulesAPI.ListShippingRules``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `ListShippingRules`: ListShippingRules200Response fmt.Fprintf(os.Stdout, "Response from `RulesAPI.ListShippingRules`: %v\n", resp) } ``` -------------------------------- ### Verify API Token Example in Go Source: https://github.com/zippendo/zippendo-go/blob/main/docs/TokensAPI.md Example usage of the VerifyApiToken endpoint in Go. It creates a VerifyApiTokenRequest with a sample API key, calls the API, and prints the response or error. Requires a valid API key and bearerAuth authorization. ```go package main import ( "context" "fmt" "os" openapiclient "github.com/zippendo/zippendo-go" ) func main() { verifyApiTokenRequest := *openapiclient.NewVerifyApiTokenRequest("zipp_live_8f3kd92ld0a7b6c5d4e3f2a1") // VerifyApiTokenRequest | configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.TokensAPI.VerifyApiToken(context.Background()).VerifyApiTokenRequest(verifyApiTokenRequest).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `TokensAPI.VerifyApiToken``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `VerifyApiToken`: VerifyApiToken200Response fmt.Fprintf(os.Stdout, "Response from `TokensAPI.VerifyApiToken`: %v\n", resp) } ``` -------------------------------- ### UploadOrgLogo Go Example Source: https://github.com/zippendo/zippendo-go/blob/main/docs/OrgsAPI.md Example of calling the UploadOrgLogo API to upload an organization logo. The file must be a PNG, JPG, or WEBP image. The response is of type GetOrgBranding200Response. ```go package main import ( "context" "fmt" "os" openapiclient "github.com/zippendo/zippendo-go" ) func main() { orgId := "org_8f3kd92ld0" // string | Organization ID file := os.NewFile(1234, "some_file") // *os.File | Image file (PNG, JPG, or WEBP) configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.OrgsAPI.UploadOrgLogo(context.Background(), orgId).File(file).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `OrgsAPI.UploadOrgLogo``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `UploadOrgLogo`: GetOrgBranding200Response fmt.Fprintf(os.Stdout, "Response from `OrgsAPI.UploadOrgLogo`: %v\n", resp) } ``` -------------------------------- ### Configure client for a different environment Source: https://github.com/zippendo/zippendo-go/blob/main/README.md Point the client at a different environment by setting cfg.Servers to a custom URL. ```go cfg := zippendo.NewConfiguration() cfg.Servers = zippendo.ServerConfigurations{{URL: "https://staging.api.zippendo.com"}} client := zippendo.NewAPIClient(cfg) ``` -------------------------------- ### ConnectCarrier example Source: https://github.com/zippendo/zippendo-go/blob/main/docs/CarriersAPI.md Example of connecting a carrier using the ConnectCarrier method. It creates a ConnectCarrierRequest with a carrier name, code, and config values, then calls the API and prints the response or error. ```go package main import ( "context" "fmt" "os" openapiclient "github.com/zippendo/zippendo-go" ) func main() { orgId := "org_01HZX9K2QF" // string | Organization ID connectCarrierRequest := *openapiclient.NewConnectCarrierRequest("PostNord", "postnord", map[string]ListCarriers200ResponseDataInnerConfigValue{"key": *openapiclient.NewListCarriers200ResponseDataInnerConfigValue()}) // ConnectCarrierRequest | configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.CarriersAPI.ConnectCarrier(context.Background(), orgId).ConnectCarrierRequest(connectCarrierRequest).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `CarriersAPI.ConnectCarrier``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `ConnectCarrier`: ListCarriers200ResponseDataInner fmt.Fprintf(os.Stdout, "Response from `CarriersAPI.ConnectCarrier`: %v\n", resp) } ``` -------------------------------- ### Set X-Zippendo-Brand default header and list brand-scoped shipments Source: https://github.com/zippendo/zippendo-go/blob/main/README.md Sets the X-Zippendo-Brand header as a default on the Configuration so every API call inherits the brand context. The example lists shipments limited to the brand; new shipments are stamped with the brand. Omit the header to cover the whole organization. ```go cfg := zippendo.NewConfiguration() cfg.AddDefaultHeader("X-Zippendo-Brand", "acme") // brand ID or slug client := zippendo.NewAPIClient(cfg) shipments, _, err := client.ShipmentsAPI.ListShipments(ctx, "org_8f3kd92ld0").Limit(50).Execute() if err != nil { panic(err) } fmt.Println(shipments.GetTotal()) // only Acme's shipments; new shipments are stamped with the brand ``` -------------------------------- ### UpdateOrderChannel Go Example Source: https://github.com/zippendo/zippendo-go/blob/main/docs/OrderChannelsAPI.md Example of calling the UpdateOrderChannel API to update an order channel. Requires orgId and channelId as string parameters, and an UpdateOrderChannelRequest object. The response is of type ListOrderChannels200ResponseDataInner. ```go package main import ( "context" "fmt" "os" openapiclient "github.com/zippendo/zippendo-go" ) func main() { orgId := "clz9k2f0a0000abcd0000zzzz" // string | Organization ID. channelId := "clz9k2f0a0001abcd1234efgh" // string | Order channel ID. updateOrderChannelRequest := *openapiclient.NewUpdateOrderChannelRequest() // UpdateOrderChannelRequest | configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.OrderChannelsAPI.UpdateOrderChannel(context.Background(), orgId, channelId).UpdateOrderChannelRequest(updateOrderChannelRequest).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `OrderChannelsAPI.UpdateOrderChannel``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `UpdateOrderChannel`: ListOrderChannels200ResponseDataInner fmt.Fprintf(os.Stdout, "Response from `OrderChannelsAPI.UpdateOrderChannel`: %v\n", resp) } ``` -------------------------------- ### BatchSplitShipment Go Example Source: https://github.com/zippendo/zippendo-go/blob/main/docs/ShipmentsAPI.md Example of calling the BatchSplitShipment API in Go. It splits a shipment into multiple shipments based on the provided request. The example uses the zippendo-go client and prints the response or error. ```go package main import ( "context" "fmt" "os" openapiclient "github.com/zippendo/zippendo-go" ) func main() { orgId := "org_1a2b3c4d" // string | Organization identifier. shipmentId := "shp_4d9e7a2f" // string | Shipment identifier. batchSplitShipmentRequest := *openapiclient.NewBatchSplitShipmentRequest("prc_5a6b7c8d", []openapiclient.BatchSplitShipmentRequestShipmentsInner{*openapiclient.NewBatchSplitShipmentRequestShipmentsInner([]openapiclient.BatchSplitShipmentRequestShipmentsInnerOrderLinesInner{*openapiclient.NewBatchSplitShipmentRequestShipmentsInnerOrderLinesInner("ol_9c1d2e3f", int32(1))})}) // BatchSplitShipmentRequest | configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.ShipmentsAPI.BatchSplitShipment(context.Background(), orgId, shipmentId).BatchSplitShipmentRequest(batchSplitShipmentRequest).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `ShipmentsAPI.BatchSplitShipment``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `BatchSplitShipment`: BatchSplitShipment201Response fmt.Fprintf(os.Stdout, "Response from `ShipmentsAPI.BatchSplitShipment`: %v\n", resp) } ``` -------------------------------- ### CreateApiToken example Source: https://github.com/zippendo/zippendo-go/blob/main/docs/TokensAPI.md Creates an API token for an organization. Requires the organization ID and a CreateApiTokenRequest with a name and scopes. Uses bearerAuth authorization. ```go package main import ( "context" "fmt" "os" openapiclient "github.com/zippendo/zippendo-go" ) func main() { orgId := "org_4d8af01qw2" // string | Organization ID createApiTokenRequest := *openapiclient.NewCreateApiTokenRequest("Warehouse integration", []string{"read:shipments"}) // CreateApiTokenRequest | configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.TokensAPI.CreateApiToken(context.Background(), orgId).CreateApiTokenRequest(createApiTokenRequest).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `TokensAPI.CreateApiToken``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `CreateApiToken`: CreateApiToken201Response fmt.Fprintf(os.Stdout, "Response from `TokensAPI.CreateApiToken`: %v\n", resp) } ``` -------------------------------- ### DeleteOrder Example Source: https://github.com/zippendo/zippendo-go/blob/main/docs/OrdersAPI.md Example of calling the DeleteOrder endpoint using the zippendo-go client. Requires orgId and orderId as strings. The response is a RevokeApiToken200Response. ```go package main import ( "context" "fmt" "os" openapiclient "github.com/zippendo/zippendo-go" ) func main() { orgId := "clz9k2f0a0000abcd0000zzzz" // string | Organization ID. orderId := "clz9k2f0a0003abcd9012mnop" // string | Order ID. configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.OrdersAPI.DeleteOrder(context.Background(), orgId, orderId).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `OrdersAPI.DeleteOrder``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `DeleteOrder`: RevokeApiToken200Response fmt.Fprintf(os.Stdout, "Response from `OrdersAPI.DeleteOrder`: %v\n", resp) } ``` -------------------------------- ### Create an order Source: https://github.com/zippendo/zippendo-go/blob/main/README.md Creates an order using CreateOrderRequest with order lines. The response includes the order ID via GetId(). ```go lines := []zippendo.CreateOrderRequestOrderLinesInner{*zippendo.NewCreateOrderRequestOrderLinesInner("T-shirt", 2)} body := zippendo.NewCreateOrderRequest("1001", "chan_7d2k1", lines) order, _, err := client.OrdersAPI.CreateOrder(ctx, "org_8f3kd92ld0").CreateOrderRequest(*body).Execute() if err != nil { panic(err) } fmt.Println(order.GetId()) ``` -------------------------------- ### CreateShippingRule example Source: https://github.com/zippendo/zippendo-go/blob/main/docs/RulesAPI.md Example of creating a shipping rule using the CreateShippingRule method. It requires an organization ID and a CreateShippingRuleRequest object. The response is a CreateShippingRule201Response. ```go package main import ( "context" "fmt" "os" openapiclient "github.com/zippendo/zippendo-go" ) func main() { orgId := "org_01HZX9K2QF" // string | Organization ID createShippingRuleRequest := *openapiclient.NewCreateShippingRuleRequest("Standard DK", "carr_01HZX9K2QF", "PNL13", []string{"EMAIL_NOTIFICATION"}, "addr_01HZX9K2QF", []string{"DK"}, []openapiclient.CreateShippingRuleRequestConditionsInner{openapiclient.createShippingRule_request_conditions_inner{CreateShippingRuleRequestConditionsInnerOneOf: openapiclient.NewCreateShippingRuleRequestConditionsInnerOneOf("weight", float32(0), float32(5), float32(39), "DKK")}}) // CreateShippingRuleRequest | configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.RulesAPI.CreateShippingRule(context.Background(), orgId).CreateShippingRuleRequest(createShippingRuleRequest).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `RulesAPI.CreateShippingRule``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `CreateShippingRule`: CreateShippingRule201Response fmt.Fprintf(os.Stdout, "Response from `RulesAPI.CreateShippingRule`: %v\n", resp) } ``` -------------------------------- ### ListAvailableCarriers Example Source: https://github.com/zippendo/zippendo-go/blob/main/docs/CarrierCatalogAPI.md Example Go code that calls the ListAvailableCarriers endpoint with an organization ID. It creates a new API client, executes the request, and prints the response or error. Requires a valid orgId and bearerAuth. ```go package main import ( "context" "fmt" "os" openapiclient "github.com/zippendo/zippendo-go" ) func main() { orgId := "org_01HZX9K2QF" // string | Organization ID configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.CarrierCatalogAPI.ListAvailableCarriers(context.Background(), orgId).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `CarrierCatalogAPI.ListAvailableCarriers``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `ListAvailableCarriers`: []ListAvailableCarriers200ResponseInner fmt.Fprintf(os.Stdout, "Response from `CarrierCatalogAPI.ListAvailableCarriers`: %v\n", resp) } ``` -------------------------------- ### GetBrandLogo Example Source: https://github.com/zippendo/zippendo-go/blob/main/docs/BrandsAPI.md Calls the BrandsAPI.GetBrandLogo endpoint to retrieve a brand logo as an *os.File. Requires orgId and brandId strings. Prints the response or error to stdout/stderr. ```go package main import ( "context" "fmt" "os" openapiclient "github.com/zippendo/zippendo-go" ) func main() { orgId := "org_8f3kd92ld0" // string | Organization ID brandId := "brnd_8f3kd92ld0" // string | Brand ID configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.BrandsAPI.GetBrandLogo(context.Background(), orgId, brandId).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `BrandsAPI.GetBrandLogo``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `GetBrandLogo`: *os.File fmt.Fprintf(os.Stdout, "Response from `BrandsAPI.GetBrandLogo`: %v\n", resp) } ``` -------------------------------- ### GetOrder Go Example Source: https://github.com/zippendo/zippendo-go/blob/main/docs/OrdersAPI.md Example of calling the GetOrder endpoint using the zippendo-go OpenAPI client. It requires an organization ID and order ID, and prints the response or error to stdout/stderr. The response type is GetOrder200Response and uses bearerAuth authorization. ```go package main import ( "context" "fmt" "os" openapiclient "github.com/zippendo/zippendo-go" ) func main() { orgId := "clz9k2f0a0000abcd0000zzzz" // string | Organization ID. orderId := "clz9k2f0a0003abcd9012mnop" // string | Order ID. configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.OrdersAPI.GetOrder(context.Background(), orgId, orderId).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `OrdersAPI.GetOrder``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `GetOrder`: GetOrder200Response fmt.Fprintf(os.Stdout, "Response from `OrdersAPI.GetOrder`: %v\n", resp) } ``` -------------------------------- ### GetOrg API Call Example Source: https://github.com/zippendo/zippendo-go/blob/main/docs/OrgsAPI.md Example of calling the GetOrg endpoint to retrieve an organization by its resource ID. Requires a valid ID string and uses the bearerAuth authorization. The response is of type GetOrg200Response. ```go package main import ( "context" "fmt" "os" openapiclient "github.com/zippendo/zippendo-go" ) func main() { id := "clz9x8a7b0001" // string | Resource ID configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.OrgsAPI.GetOrg(context.Background(), id).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `OrgsAPI.GetOrg``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `GetOrg`: GetOrg200Response fmt.Fprintf(os.Stdout, "Response from `OrgsAPI.GetOrg`: %v\n", resp) } ``` -------------------------------- ### GetOrderChannel example Source: https://github.com/zippendo/zippendo-go/blob/main/docs/OrderChannelsAPI.md Calls the OrderChannelsAPI.GetOrderChannel endpoint with an organization ID and order channel ID. Prints the response or error to stdout/stderr. Requires bearerAuth authorization. ```go package main import ( "context" "fmt" "os" openapiclient "github.com/zippendo/zippendo-go" ) func main() { orgId := "clz9k2f0a0000abcd0000zzzz" // string | Organization ID. channelId := "clz9k2f0a0001abcd1234efgh" // string | Order channel ID. configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.OrderChannelsAPI.GetOrderChannel(context.Background(), orgId, channelId).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `OrderChannelsAPI.GetOrderChannel``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `GetOrderChannel`: ListOrderChannels200ResponseDataInner fmt.Fprintf(os.Stdout, "Response from `OrderChannelsAPI.GetOrderChannel`: %v\n", resp) } ``` -------------------------------- ### ListCarrierProductServicePoints Go Example Source: https://github.com/zippendo/zippendo-go/blob/main/docs/CarriersAPI.md Calls the CarriersAPI.ListCarrierProductServicePoints endpoint to list product service points. Requires orgId, carrierId, productId, and a ListCarrierProductServicePointsRequest with address details. Prints the response or error to stdout/stderr. ```go package main import ( "context" "fmt" "os" openapiclient "github.com/zippendo/zippendo-go" ) func main() { orgId := "org_01HZX9K2QF" // string | Organization ID carrierId := "carr_01HZX9K2QF" // string | Carrier ID productId := "PNL13" // string | Carrier product ID listCarrierProductServicePointsRequest := *openapiclient.NewListCarrierProductServicePointsRequest("Vesterbrogade 1", "1620", "København", "DK") // ListCarrierProductServicePointsRequest | configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.CarriersAPI.ListCarrierProductServicePoints(context.Background(), orgId, carrierId, productId).ListCarrierProductServicePointsRequest(listCarrierProductServicePointsRequest).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `CarriersAPI.ListCarrierProductServicePoints``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `ListCarrierProductServicePoints`: []ListCarrierProductServicePoints200ResponseInner fmt.Fprintf(os.Stdout, "Response from `CarriersAPI.ListCarrierProductServicePoints`: %v\n", resp) } ``` -------------------------------- ### UpdateOrg Go Example Source: https://github.com/zippendo/zippendo-go/blob/main/docs/OrgsAPI.md Calls the OrgsAPI.UpdateOrg endpoint with a resource ID and an UpdateOrgRequest. Prints the response or error to stdout/stderr. Requires bearerAuth authorization and sends application/json content. ```go package main import ( "context" "fmt" "os" openapiclient "github.com/zippendo/zippendo-go" ) func main() { id := "clz9x8a7b0001" // string | Resource ID updateOrgRequest := *openapiclient.NewUpdateOrgRequest() // UpdateOrgRequest | configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.OrgsAPI.UpdateOrg(context.Background(), id).UpdateOrgRequest(updateOrgRequest).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `OrgsAPI.UpdateOrg``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `UpdateOrg`: UpdateOrg200Response fmt.Fprintf(os.Stdout, "Response from `OrgsAPI.UpdateOrg`: %v\n", resp) } ``` -------------------------------- ### GetOrderChannelWebhookStatus Example Source: https://github.com/zippendo/zippendo-go/blob/main/docs/OrderChannelsAPI.md Calls the OrderChannelsAPI.GetOrderChannelWebhookStatus endpoint with the provided orgId and channelId. Prints the response or error to stdout/stderr. Requires bearerAuth authorization. ```go package main import ( "context" "fmt" "os" openapiclient "github.com/zippendo/zippendo-go" ) func main() { orgId := "clz9k2f0a0000abcd0000zzzz" // string | Organization ID. channelId := "clz9k2f0a0001abcd1234efgh" // string | Order channel ID. configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.OrderChannelsAPI.GetOrderChannelWebhookStatus(context.Background(), orgId, channelId).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `OrderChannelsAPI.GetOrderChannelWebhookStatus``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `GetOrderChannelWebhookStatus`: GetOrderChannelWebhookStatus200Response fmt.Fprintf(os.Stdout, "Response from `OrderChannelsAPI.GetOrderChannelWebhookStatus`: %v\n", resp) } ``` -------------------------------- ### GetOrgBranding Example Source: https://github.com/zippendo/zippendo-go/blob/main/docs/OrgsAPI.md Calls the OrgsAPI.GetOrgBranding endpoint with an organization ID. Prints the response or error to stdout/stderr. Requires a valid orgId and bearerAuth configuration. ```go package main import ( "context" "fmt" "os" openapiclient "github.com/zippendo/zippendo-go" ) func main() { orgId := "org_8f3kd92ld0" // string | Organization ID configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.OrgsAPI.GetOrgBranding(context.Background(), orgId).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `OrgsAPI.GetOrgBranding``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `GetOrgBranding`: GetOrgBranding200Response fmt.Fprintf(os.Stdout, "Response from `OrgsAPI.GetOrgBranding`: %v\n", resp) } ``` -------------------------------- ### ListShipments Go Example Source: https://github.com/zippendo/zippendo-go/blob/main/docs/ShipmentsAPI.md Example of calling the ListShipments API to list shipments with optional filters. Uses the zippendo-go client. The filter parameter is a JSON-encoded advanced filter; an invalid filter returns 400 FILTER_INVALID. The brandScope parameter controls brand context; 'shared' with a brand-scoped request returns no rows for brand-owned records. ```go package main import ( "context" "fmt" "os" openapiclient "github.com/zippendo/zippendo-go" ) func main() { orgId := "org_8f3kd92ld0" // string | Organization ID page := int32(1) // int32 | Page number (1-based) (optional) (default to 1) limit := int32(20) // int32 | Items per page (max 100) (optional) (default to 20) brandId := "brnd_8f3kd92ld0" // string | Filter by brand. Pass a brand ID, or \"none\" for records not assigned to any brand. (optional) brandScope := "own" // string | How the brand context narrows this list: \"own\" returns only rows assigned to the current brand (requires a brand session, a brand-bound token, or the X-Zippendo-Brand header), \"shared\" returns only unassigned organization-wide rows, \"both\" (default) returns both. The X-Zippendo-Brand-Scope header supplies a default when the parameter is omitted. For strictly brand-owned records (orders, shipments), a brand-scoped request combined with \"shared\" returns no rows, since those records are never visible organization-wide from within a brand context. (optional) status := "dispatched" // string | Filter by shipment status. (optional) type_ := "outbound" // string | Filter by direction. (optional) search := "SHIP-1042" // string | Search by shipment reference or parcel tracking number. (optional) filter := "{\"conjunction\":\"and\",\"conditions\":[{\"id\":\"c_1\",\"field\":\"status\",\"operator\":\"in\",\"value\":[\"pending\",\"processing\"]}]}" // string | Advanced filter as a JSON-encoded definition: a `conjunction` (`and`/`or`) over `conditions`, each `{ id, field, operator, value }` or a nested group. Fields and operators per list are documented under Filtering lists in the API overview. An invalid filter returns 400 `FILTER_INVALID`. (optional) configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.ShipmentsAPI.ListShipments(context.Background(), orgId).Page(page).Limit(limit).BrandId(brandId).BrandScope(brandScope).Status(status).Type_(type_).Search(search).Filter(filter).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `ShipmentsAPI.ListShipments``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `ListShipments`: ListShipments200Response fmt.Fprintf(os.Stdout, "Response from `ShipmentsAPI.ListShipments`: %v\n", resp) } ``` -------------------------------- ### ListOrders Go Example Source: https://github.com/zippendo/zippendo-go/blob/main/docs/OrdersAPI.md Calls the ListOrders endpoint with optional filters. Requires an organization ID and a bearer token. The response is a ListOrders200Response. Invalid filter returns 400 FILTER_INVALID. ```go package main import ( "context" "fmt" "os" openapiclient "github.com/zippendo/zippendo-go" ) func main() { orgId := "org_8f3kd92ld0" // string | Organization ID page := int32(1) // int32 | Page number (1-based) (optional) (default to 1) limit := int32(20) // int32 | Items per page (max 100) (optional) (default to 20) brandId := "brnd_8f3kd92ld0" // string | Filter by brand. Pass a brand ID, or \"none\" for records not assigned to any brand. (optional) brandScope := "own" // string | How the brand context narrows this list: \"own\" returns only rows assigned to the current brand (requires a brand session, a brand-bound token, or the X-Zippendo-Brand header), \"shared\" returns only unassigned organization-wide rows, \"both\" (default) returns both. The X-Zippendo-Brand-Scope header supplies a default when the parameter is omitted. For strictly brand-owned records (orders, shipments), a brand-scoped request combined with \"shared\" returns no rows, since those records are never visible organization-wide from within a brand context. (optional) status := "processing" // string | Order fulfillment status derived from its shipments. (optional) orderChannelId := "clz9k2f0a0001abcd1234efgh" // string | Filter by order channel ID. (optional) search := "Anna" // string | Search by order number or customer name/email. (optional) filter := "{\"conjunction\":\"and\",\"conditions\":[{\"id\":\"c_1\",\"field\":\"status\",\"operator\":\"in\",\"value\":[\"pending\",\"processing\"]}]}" // string | Advanced filter as a JSON-encoded definition: a `conjunction` (`and`/`or`) over `conditions`, each `{ id, field, operator, value }` or a nested group. Fields and operators per list are documented under Filtering lists in the API overview. An invalid filter returns 400 `FILTER_INVALID`. (optional) configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.OrdersAPI.ListOrders(context.Background(), orgId).Page(page).Limit(limit).BrandId(brandId).BrandScope(brandScope).Status(status).OrderChannelId(orderChannelId).Search(search).Filter(filter).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `OrdersAPI.ListOrders``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `ListOrders`: ListOrders200Response fmt.Fprintf(os.Stdout, "Response from `OrdersAPI.ListOrders`: %v\n", resp) } ``` -------------------------------- ### List shipments with pagination Source: https://github.com/zippendo/zippendo-go/blob/main/README.md List endpoints accept .Page(...) (1-based) and .Limit(...), and return a page with GetData() plus GetTotal(), GetPage(), GetLimit(), and GetTotalPages(). ```go result, _, err := client.ShipmentsAPI.ListShipments(ctx, "org_8f3kd92ld0").Page(1).Limit(50).Execute() if err != nil { panic(err) } fmt.Println(result.GetData()) // []Shipment fmt.Println(result.GetTotal(), result.GetTotalPages()) ``` -------------------------------- ### Manage brands with BrandsAPI (create, list, archive) Source: https://github.com/zippendo/zippendo-go/blob/main/README.md Uses a client without the brand default header to administer brands. Creates a brand, lists all brands, and archives the created brand. Archived brands keep their slug and can be restored with UnarchiveOrgBrand. ```go created, _, err := client.BrandsAPI.CreateOrgBrand(ctx, "org_8f3kd92ld0"). CreateOrgBrandRequest(zippendo.CreateOrgBrandRequest{ Name: "Acme", CompanyName: *zippendo.NewNullableString(zippendo.PtrString("Acme ApS")), }).Execute() if err != nil { panic(err) } page, _, err := client.BrandsAPI.ListOrgBrands(ctx, "org_8f3kd92ld0").Execute() _, _, err = client.BrandsAPI.ArchiveOrgBrand(ctx, "org_8f3kd92ld0", created.GetId()).Execute() ``` -------------------------------- ### GetOrgWebhook Example Source: https://github.com/zippendo/zippendo-go/blob/main/docs/WebhooksAPI.md Example of calling the GetOrgWebhook API to retrieve a webhook by organization ID and webhook ID. Requires bearerAuth authorization. The response is of type CreateOrgWebhook201Response. ```go package main import ( "context" "fmt" "os" openapiclient "github.com/zippendo/zippendo-go" ) func main() { orgId := "org_clx1a2b3c4" // string | Organization ID webhookId := "wh_clx1a2b3c4" // string | Webhook ID configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.WebhooksAPI.GetOrgWebhook(context.Background(), orgId, webhookId).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `WebhooksAPI.GetOrgWebhook``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `GetOrgWebhook`: CreateOrgWebhook201Response fmt.Fprintf(os.Stdout, "Response from `WebhooksAPI.GetOrgWebhook`: %v\n", resp) } ``` -------------------------------- ### DeleteOrgWebhook Example Source: https://github.com/zippendo/zippendo-go/blob/main/docs/WebhooksAPI.md Example Go code that calls the DeleteOrgWebhook API to delete a webhook. It requires an organization ID and webhook ID, and prints the response or error. ```go package main import ( "context" "fmt" "os" openapiclient "github.com/zippendo/zippendo-go" ) func main() { orgId := "org_clx1a2b3c4" // string | Organization ID webhookId := "wh_clx1a2b3c4" // string | Webhook ID configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.WebhooksAPI.DeleteOrgWebhook(context.Background(), orgId, webhookId).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `WebhooksAPI.DeleteOrgWebhook``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `DeleteOrgWebhook`: DeleteOrgWebhook200Response fmt.Fprintf(os.Stdout, "Response from `WebhooksAPI.DeleteOrgWebhook`: %v\n", resp) } ``` -------------------------------- ### Authenticate with API token Source: https://github.com/zippendo/zippendo-go/blob/main/README.md Create an API client and supply a Bearer token (prefixed with `zipp_`) via the request context. The token is read from the ZIPPENDO_API_TOKEN environment variable. The base URL defaults to https://api.zippendo.com. ```go import ( "context" "os" zippendo "github.com/zippendo/zippendo-go" ) client := zippendo.NewAPIClient(zippendo.NewConfiguration()) ctx := context.WithValue(context.Background(), zippendo.ContextAccessToken, os.Getenv("ZIPPENDO_API_TOKEN")) ``` -------------------------------- ### NewCreateOrgWebhook201ResponseWithDefaults Source: https://github.com/zippendo/zippendo-go/blob/main/docs/CreateOrgWebhook201Response.md Constructor that instantiates a new CreateOrgWebhook201Response object with only default values assigned to properties that have defaults. It does not guarantee that properties required by the API are set. ```APIDOC ## NewCreateOrgWebhook201ResponseWithDefaults ### Description Constructor that instantiates a new CreateOrgWebhook201Response object with only default values assigned to properties that have defaults. It does not guarantee that properties required by the API are set. ### Method `func NewCreateOrgWebhook201ResponseWithDefaults() *CreateOrgWebhook201Response` ### Returns - **\*CreateOrgWebhook201Response** - A pointer to the newly created CreateOrgWebhook201Response object with default values. ```