diff --git a/client/address.go b/client/address.go index c75db4b..ae9d9ff 100644 --- a/client/address.go +++ b/client/address.go @@ -9,32 +9,32 @@ import ( ) // CreateAddress creates a new address object. -func (c *Client) CreateAddress(input *models.AddressInput) (*models.AddressOutput, error) { +func (c *Client) CreateAddress(input *models.AddressInput) (*models.Address, error) { if input == nil { return nil, errors.New("nil input") } - output := &models.AddressOutput{} + output := &models.Address{} err := c.do(http.MethodPost, "/addresses/", input, output) return output, err } // RetrieveAddress retrieves an existing address by object id. -func (c *Client) RetrieveAddress(objectID string) (*models.AddressOutput, error) { +func (c *Client) RetrieveAddress(objectID string) (*models.Address, error) { if objectID == "" { return nil, errors.New("Empty object ID") } - output := &models.AddressOutput{} + output := &models.Address{} err := c.do(http.MethodGet, "/addresses/"+objectID, nil, output) return output, err } // ListAllAddresses lists all addresses. -func (c *Client) ListAllAddresses() ([]*models.AddressOutput, error) { - list := []*models.AddressOutput{} +func (c *Client) ListAllAddresses() ([]*models.Address, error) { + list := []*models.Address{} err := c.doList(http.MethodGet, "/addresses/", nil, func(v json.RawMessage) error { - item := &models.AddressOutput{} + item := &models.Address{} if err := json.Unmarshal(v, item); err != nil { return err } diff --git a/client/batch.go b/client/batch.go index bd19ce9..1b3c01c 100644 --- a/client/batch.go +++ b/client/batch.go @@ -12,7 +12,7 @@ import ( // RetrieveBatch retrieves an existing batch. BatchShipments are displayed 100 at a time. // You can iterate through each "page" by specifying non-zero value to page parameter. // You can also filter based on BatchShipment status using objectResultsFilter parameter -func (c *Client) RetrieveBatch(objectID string, page uint, objectResultsFilter string) (*models.BatchOutput, error) { +func (c *Client) RetrieveBatch(objectID string, page uint, objectResultsFilter string) (*models.Batch, error) { if objectID == "" { return nil, errors.New("Empty object ID") } @@ -29,13 +29,13 @@ func (c *Client) RetrieveBatch(objectID string, page uint, objectResultsFilter s url += "?" + strings.Join(qs, "&") } - output := &models.BatchOutput{} + output := &models.Batch{} err := c.do(http.MethodGet, url, nil, output) return output, err } // AddBatchShipmentsToBatch adds batch shipment(s) to an existing Batch. -func (c *Client) AddBatchShipmentsToBatch(objectID string, batchShipments []*models.BatchShipmentInput) (*models.BatchOutput, error) { +func (c *Client) AddBatchShipmentsToBatch(objectID string, batchShipments []*models.BatchShipmentInput) (*models.Batch, error) { if objectID == "" { return nil, errors.New("Empty object ID") } @@ -43,13 +43,13 @@ func (c *Client) AddBatchShipmentsToBatch(objectID string, batchShipments []*mod return nil, errors.New("nil batch shipments") } - output := &models.BatchOutput{} + output := &models.Batch{} err := c.do(http.MethodPost, "/batches/"+objectID+"/add_shipments", &batchShipments, output) return output, err } // RemoveBatchShipmentsFromBatch removes batch shipment(s) from an existing Batch. -func (c *Client) RemoveBatchShipmentsFromBatch(objectID string, batchShipmentIDs []string) (*models.BatchOutput, error) { +func (c *Client) RemoveBatchShipmentsFromBatch(objectID string, batchShipmentIDs []string) (*models.Batch, error) { if objectID == "" { return nil, errors.New("Empty object ID") } @@ -57,7 +57,7 @@ func (c *Client) RemoveBatchShipmentsFromBatch(objectID string, batchShipmentIDs return nil, errors.New("nil batch shipment IDs") } - output := &models.BatchOutput{} + output := &models.Batch{} err := c.do(http.MethodPost, "/batches/"+objectID+"/remove_shipments", &batchShipmentIDs, output) return output, err } @@ -66,12 +66,12 @@ func (c *Client) RemoveBatchShipmentsFromBatch(objectID string, batchShipmentIDs // Once you send invoke this function, the batch ObjectStatus will be change to PURCHASING. // When all the shipments are purchased, the ObjectStatus will change to PURCHASED // and you will receive a batch_purchased webhook indicating that the batch has been purchased. -func (c *Client) PurchaseBatch(objectID string) (*models.BatchOutput, error) { +func (c *Client) PurchaseBatch(objectID string) (*models.Batch, error) { if objectID == "" { return nil, errors.New("Empty object ID") } - output := &models.BatchOutput{} + output := &models.Batch{} err := c.do(http.MethodPost, "/batches/"+objectID+"/purchase", nil, output) return output, err } diff --git a/client/carrier_account.go b/client/carrier_account.go index f884412..5199f25 100644 --- a/client/carrier_account.go +++ b/client/carrier_account.go @@ -9,32 +9,32 @@ import ( ) // CreateCarrierAccount creates a new carrier account object. -func (c *Client) CreateCarrierAccount(input *models.CarrierAccountInput) (*models.CarrierAccountOutput, error) { +func (c *Client) CreateCarrierAccount(input *models.CarrierAccountInput) (*models.CarrierAccount, error) { if input == nil { return nil, errors.New("nil input") } - output := &models.CarrierAccountOutput{} + output := &models.CarrierAccount{} err := c.do(http.MethodPost, "/carrier_accounts/", input, output) return output, err } // RetrieveCarrierAccount retrieves an existing carrier account by object id. -func (c *Client) RetrieveCarrierAccount(objectID string) (*models.CarrierAccountOutput, error) { +func (c *Client) RetrieveCarrierAccount(objectID string) (*models.CarrierAccount, error) { if objectID == "" { return nil, errors.New("Empty object ID") } - output := &models.CarrierAccountOutput{} + output := &models.CarrierAccount{} err := c.do(http.MethodGet, "/carrier_accounts/"+objectID, nil, output) return output, err } // ListAllCarrierAccounts lists all carrier accounts. -func (c *Client) ListAllCarrierAccounts() ([]*models.CarrierAccountOutput, error) { - list := []*models.CarrierAccountOutput{} +func (c *Client) ListAllCarrierAccounts() ([]*models.CarrierAccount, error) { + list := []*models.CarrierAccount{} err := c.doList(http.MethodGet, "/carrier_accounts/", nil, func(v json.RawMessage) error { - item := &models.CarrierAccountOutput{} + item := &models.CarrierAccount{} if err := json.Unmarshal(v, item); err != nil { return err } @@ -47,7 +47,7 @@ func (c *Client) ListAllCarrierAccounts() ([]*models.CarrierAccountOutput, error // UpdateCarrierAccount updates an existing carrier account. // AccountID and Carrier cannot be updated because they form the unique identifier together. -func (c *Client) UpdateCarrierAccount(objectID string, input *models.CarrierAccountInput) (*models.CarrierAccountOutput, error) { +func (c *Client) UpdateCarrierAccount(objectID string, input *models.CarrierAccountInput) (*models.CarrierAccount, error) { if objectID == "" { return nil, errors.New("Empty object ID") } @@ -55,7 +55,7 @@ func (c *Client) UpdateCarrierAccount(objectID string, input *models.CarrierAcco return nil, errors.New("nil input") } - output := &models.CarrierAccountOutput{} + output := &models.CarrierAccount{} err := c.do(http.MethodPut, "/carrier_accounts/"+objectID, input, output) return output, err } diff --git a/client/customs.go b/client/customs.go index 590eaef..f69a59d 100644 --- a/client/customs.go +++ b/client/customs.go @@ -9,32 +9,32 @@ import ( ) // CreateCustomsItem creates a new customs item object. -func (c *Client) CreateCustomsItem(input *models.CustomsItemInput) (*models.CustomsItemOutput, error) { +func (c *Client) CreateCustomsItem(input *models.CustomsItemInput) (*models.CustomsItem, error) { if input == nil { return nil, errors.New("nil input") } - output := &models.CustomsItemOutput{} + output := &models.CustomsItem{} err := c.do(http.MethodPost, "/customs/items/", input, output) return output, err } // RetrieveCustomsItem retrieves an existing customs item by object id. -func (c *Client) RetrieveCustomsItem(objectID string) (*models.CustomsItemOutput, error) { +func (c *Client) RetrieveCustomsItem(objectID string) (*models.CustomsItem, error) { if objectID == "" { return nil, errors.New("Empty object ID") } - output := &models.CustomsItemOutput{} + output := &models.CustomsItem{} err := c.do(http.MethodGet, "/customs/items/"+objectID, nil, output) return output, err } // ListAllCustomsItems lists all customs item objects. -func (c *Client) ListAllCustomsItems() ([]*models.CustomsItemOutput, error) { - list := []*models.CustomsItemOutput{} +func (c *Client) ListAllCustomsItems() ([]*models.CustomsItem, error) { + list := []*models.CustomsItem{} err := c.doList(http.MethodGet, "/customs/items/", nil, func(v json.RawMessage) error { - item := &models.CustomsItemOutput{} + item := &models.CustomsItem{} if err := json.Unmarshal(v, item); err != nil { return err } @@ -46,32 +46,32 @@ func (c *Client) ListAllCustomsItems() ([]*models.CustomsItemOutput, error) { } // CreateCustomsDeclaration creates a new customs declaration object. -func (c *Client) CreateCustomsDeclaration(input *models.CustomsDeclarationInput) (*models.CustomsDeclarationOutput, error) { +func (c *Client) CreateCustomsDeclaration(input *models.CustomsDeclarationInput) (*models.CustomsDeclaration, error) { if input == nil { return nil, errors.New("nil input") } - output := &models.CustomsDeclarationOutput{} + output := &models.CustomsDeclaration{} err := c.do(http.MethodPost, "/customs/declarations/", input, output) return output, err } // RetrieveCustomsDeclaration retrieves an existing customs declaration by object id. -func (c *Client) RetrieveCustomsDeclaration(objectID string) (*models.CustomsDeclarationOutput, error) { +func (c *Client) RetrieveCustomsDeclaration(objectID string) (*models.CustomsDeclaration, error) { if objectID == "" { return nil, errors.New("Empty object ID") } - output := &models.CustomsDeclarationOutput{} + output := &models.CustomsDeclaration{} err := c.do(http.MethodGet, "/customs/declarations/"+objectID, nil, output) return output, err } // ListAllCustomsDeclaration lists all customs declaration objects. -func (c *Client) ListAllCustomsDeclaration() ([]*models.CustomsDeclarationOutput, error) { - list := []*models.CustomsDeclarationOutput{} +func (c *Client) ListAllCustomsDeclaration() ([]*models.CustomsDeclaration, error) { + list := []*models.CustomsDeclaration{} err := c.doList(http.MethodGet, "/customs/declarations/", nil, func(v json.RawMessage) error { - item := &models.CustomsDeclarationOutput{} + item := &models.CustomsDeclaration{} if err := json.Unmarshal(v, item); err != nil { return err } diff --git a/client/manifest.go b/client/manifest.go index 50696e7..514b5fe 100644 --- a/client/manifest.go +++ b/client/manifest.go @@ -9,32 +9,32 @@ import ( ) // CreateManifest creates a new manifest object. -func (c *Client) CreateManifest(input *models.ManifestInput) (*models.ManifestOutput, error) { +func (c *Client) CreateManifest(input *models.ManifestInput) (*models.Manifest, error) { if input == nil { return nil, errors.New("nil input") } - output := &models.ManifestOutput{} + output := &models.Manifest{} err := c.do(http.MethodPost, "/manifests/", input, output) return output, err } // RetrieveManifest retrieves an existing manifest by object id. -func (c *Client) RetrieveManifest(objectID string) (*models.ManifestOutput, error) { +func (c *Client) RetrieveManifest(objectID string) (*models.Manifest, error) { if objectID == "" { return nil, errors.New("Empty object ID") } - output := &models.ManifestOutput{} + output := &models.Manifest{} err := c.do(http.MethodGet, "/manifests/"+objectID, nil, output) return output, err } // ListAllManifests lists all manifest objects. -func (c *Client) ListAllManifests() ([]*models.ManifestOutput, error) { - list := []*models.ManifestOutput{} +func (c *Client) ListAllManifests() ([]*models.Manifest, error) { + list := []*models.Manifest{} err := c.doList(http.MethodGet, "/manifests/", nil, func(v json.RawMessage) error { - item := &models.ManifestOutput{} + item := &models.Manifest{} if err := json.Unmarshal(v, item); err != nil { return err } diff --git a/client/parcel.go b/client/parcel.go index 46f5973..2cf32bb 100644 --- a/client/parcel.go +++ b/client/parcel.go @@ -9,32 +9,32 @@ import ( ) // CreateParcel creates a new parcel object. -func (c *Client) CreateParcel(input *models.ParcelInput) (*models.ParcelOutput, error) { +func (c *Client) CreateParcel(input *models.ParcelInput) (*models.Parcel, error) { if input == nil { return nil, errors.New("nil input") } - output := &models.ParcelOutput{} + output := &models.Parcel{} err := c.do(http.MethodPost, "/parcels/", input, output) return output, err } // RetrieveParcel retrieves an existing parcel by object id. -func (c *Client) RetrieveParcel(objectID string) (*models.ParcelOutput, error) { +func (c *Client) RetrieveParcel(objectID string) (*models.Parcel, error) { if objectID == "" { return nil, errors.New("Empty object ID") } - output := &models.ParcelOutput{} + output := &models.Parcel{} err := c.do(http.MethodGet, "/parcels/"+objectID, nil, output) return output, err } // ListAllParcels lists all parcel objects. -func (c *Client) ListAllParcels() ([]*models.ParcelOutput, error) { - list := []*models.ParcelOutput{} +func (c *Client) ListAllParcels() ([]*models.Parcel, error) { + list := []*models.Parcel{} err := c.doList(http.MethodGet, "/parcels/", nil, func(v json.RawMessage) error { - item := &models.ParcelOutput{} + item := &models.Parcel{} if err := json.Unmarshal(v, item); err != nil { return err } diff --git a/client/rate.go b/client/rate.go index 6240bbe..4af42ba 100644 --- a/client/rate.go +++ b/client/rate.go @@ -9,7 +9,7 @@ import ( ) // GetShippingRates gets rates for a shipping object. -func (c *Client) GetShippingRates(shipmentObjectID, currencyCode string) ([]*models.RateOutput, error) { +func (c *Client) GetShippingRates(shipmentObjectID, currencyCode string) ([]*models.Rate, error) { if shipmentObjectID == "" { return nil, errors.New("Empty shipment object ID") } @@ -17,9 +17,9 @@ func (c *Client) GetShippingRates(shipmentObjectID, currencyCode string) ([]*mod return nil, errors.New("Empty currency code") } - list := []*models.RateOutput{} + list := []*models.Rate{} err := c.doList(http.MethodGet, "/shipments/"+shipmentObjectID+"/rates/"+currencyCode, nil, func(v json.RawMessage) error { - item := &models.RateOutput{} + item := &models.Rate{} if err := json.Unmarshal(v, item); err != nil { return err } @@ -31,21 +31,21 @@ func (c *Client) GetShippingRates(shipmentObjectID, currencyCode string) ([]*mod } // RetrieveRate retrieves an existing rate by object id. -func (c *Client) RetrieveRate(objectID string) (*models.RateOutput, error) { +func (c *Client) RetrieveRate(objectID string) (*models.Rate, error) { if objectID == "" { return nil, errors.New("Empty object ID") } - output := &models.RateOutput{} + output := &models.Rate{} err := c.do(http.MethodGet, "/rates/"+objectID, nil, output) return output, err } // ListAllRates lists all the rate objects that have been previously obtained through GetShippingRates function. -func (c *Client) ListAllRates() ([]*models.RateOutput, error) { - list := []*models.RateOutput{} +func (c *Client) ListAllRates() ([]*models.Rate, error) { + list := []*models.Rate{} err := c.doList(http.MethodGet, "/rates/", nil, func(v json.RawMessage) error { - item := &models.RateOutput{} + item := &models.Rate{} if err := json.Unmarshal(v, item); err != nil { return err } diff --git a/client/refund.go b/client/refund.go index 9a2ce89..71ce16d 100644 --- a/client/refund.go +++ b/client/refund.go @@ -9,32 +9,32 @@ import ( ) // CreateRefund creates a new refund object. -func (c *Client) CreateRefund(input *models.RefundInput) (*models.RefundOutput, error) { +func (c *Client) CreateRefund(input *models.RefundInput) (*models.Refund, error) { if input == nil { return nil, errors.New("nil input") } - output := &models.RefundOutput{} + output := &models.Refund{} err := c.do(http.MethodPost, "/refunds/", input, output) return output, err } // RetrieveRefund retrieves an existing refund by object id. -func (c *Client) RetrieveRefund(objectID string) (*models.RefundOutput, error) { +func (c *Client) RetrieveRefund(objectID string) (*models.Refund, error) { if objectID == "" { return nil, errors.New("Empty object ID") } - output := &models.RefundOutput{} + output := &models.Refund{} err := c.do(http.MethodGet, "/refunds/"+objectID, nil, output) return output, err } // ListAllRefunds list all refund objects. -func (c *Client) ListAllRefunds() ([]*models.RefundOutput, error) { - list := []*models.RefundOutput{} +func (c *Client) ListAllRefunds() ([]*models.Refund, error) { + list := []*models.Refund{} err := c.doList(http.MethodGet, "/refunds/", nil, func(v json.RawMessage) error { - item := &models.RefundOutput{} + item := &models.Refund{} if err := json.Unmarshal(v, item); err != nil { return err } diff --git a/client/shipment.go b/client/shipment.go index d440b9a..a384020 100644 --- a/client/shipment.go +++ b/client/shipment.go @@ -17,7 +17,7 @@ import ( // The Shippo API currently supports Scan-based returns for USPS, Fedex and UPS. // When the ReturnOf flag is set, Shippo API will automatically swap the address_from and address_to fields for label creation. // Please check the return service terms and condition for the carrier you intend to use. -func (c *Client) CreateShipment(input *models.ShipmentInput) (*models.ShipmentOutput, error) { +func (c *Client) CreateShipment(input *models.ShipmentInput) (*models.Shipment, error) { if input == nil { return nil, errors.New("nil input") } @@ -26,27 +26,27 @@ func (c *Client) CreateShipment(input *models.ShipmentInput) (*models.ShipmentOu input.SubmissionDate = time.Now() } - output := &models.ShipmentOutput{} + output := &models.Shipment{} err := c.do(http.MethodPost, "/shipments/", input, output) return output, err } // RetrieveShipment retrieves an existing shipment by object id. -func (c *Client) RetrieveShipment(objectID string) (*models.ShipmentOutput, error) { +func (c *Client) RetrieveShipment(objectID string) (*models.Shipment, error) { if objectID == "" { return nil, errors.New("Empty object ID") } - output := &models.ShipmentOutput{} + output := &models.Shipment{} err := c.do(http.MethodGet, "/shipments/"+objectID, nil, output) return output, err } // ListAllShipments lists all shipment objects. -func (c *Client) ListAllShipments() ([]*models.ShipmentOutput, error) { - list := []*models.ShipmentOutput{} +func (c *Client) ListAllShipments() ([]*models.Shipment, error) { + list := []*models.Shipment{} err := c.doList(http.MethodGet, "/shipments/", nil, func(v json.RawMessage) error { - item := &models.ShipmentOutput{} + item := &models.Shipment{} if err := json.Unmarshal(v, item); err != nil { return err } diff --git a/client/tracking_status.go b/client/tracking_status.go index 500ddaf..1477aff 100644 --- a/client/tracking_status.go +++ b/client/tracking_status.go @@ -8,7 +8,7 @@ import ( ) // GetTrackingUpdate requests the tracking status of a shipment. -func (c *Client) GetTrackingUpdate(carrier, trackingNumber string) (*models.TrackingStatusOutput, error) { +func (c *Client) GetTrackingUpdate(carrier, trackingNumber string) (*models.TrackingStatus, error) { if carrier == "" { return nil, errors.New("Empty carrier") } @@ -16,7 +16,7 @@ func (c *Client) GetTrackingUpdate(carrier, trackingNumber string) (*models.Trac return nil, errors.New("Empty tracking number") } - output := &models.TrackingStatusOutput{} + output := &models.TrackingStatus{} err := c.do(http.MethodGet, "/trakcs/"+carrier+"/"+trackingNumber, nil, output) return output, err } @@ -24,7 +24,7 @@ func (c *Client) GetTrackingUpdate(carrier, trackingNumber string) (*models.Trac // RegisterTrackingWebhook registers a tracking webhook. // TODO: documentation on this API endpoint is not clear. // https://goshippo.com/docs/reference#track-create -func (c *Client) RegisterTrackingWebhook(carrier, trackingNumber string) (*models.TrackingStatusOutput, error) { +func (c *Client) RegisterTrackingWebhook(carrier, trackingNumber string) (*models.TrackingStatus, error) { if carrier == "" { return nil, errors.New("Empty carrier") } @@ -32,7 +32,7 @@ func (c *Client) RegisterTrackingWebhook(carrier, trackingNumber string) (*model return nil, errors.New("Empty tracking number") } - output := &models.TrackingStatusOutput{} + output := &models.TrackingStatus{} err := c.do(http.MethodPost, "/trakcs/"+carrier+"/"+trackingNumber, nil, output) return output, err } diff --git a/client/transaction.go b/client/transaction.go index d6d0355..88a3bf7 100644 --- a/client/transaction.go +++ b/client/transaction.go @@ -9,32 +9,32 @@ import ( ) // PurchaseShippingLabel creates a new transaction object and purchases the shipping label for the provided rate. -func (c *Client) PurchaseShippingLabel(input *models.TransactionInput) (*models.TransactionOutput, error) { +func (c *Client) PurchaseShippingLabel(input *models.TransactionInput) (*models.Transaction, error) { if input == nil { return nil, errors.New("nil input") } - output := &models.TransactionOutput{} + output := &models.Transaction{} err := c.do(http.MethodPost, "/transactions/", input, output) return output, err } // RetrieveTransaction retrieves an existing transaction by object id. -func (c *Client) RetrieveTransaction(objectID string) (*models.TransactionOutput, error) { +func (c *Client) RetrieveTransaction(objectID string) (*models.Transaction, error) { if objectID == "" { return nil, errors.New("Empty object ID") } - output := &models.TransactionOutput{} + output := &models.Transaction{} err := c.do(http.MethodGet, "/transactions/"+objectID, nil, output) return output, err } // ListAllTransactions lists all transaction objects. -func (c *Client) ListAllTransactions() ([]*models.TransactionOutput, error) { - list := []*models.TransactionOutput{} +func (c *Client) ListAllTransactions() ([]*models.Transaction, error) { + list := []*models.Transaction{} err := c.doList(http.MethodGet, "/transactions/", nil, func(v json.RawMessage) error { - item := &models.TransactionOutput{} + item := &models.Transaction{} if err := json.Unmarshal(v, item); err != nil { return err } diff --git a/example/main.go b/example/main.go index 58a3d11..be72664 100644 --- a/example/main.go +++ b/example/main.go @@ -27,7 +27,7 @@ func main() { purchaseShippingLabel(c, shipment) } -func createShipment(c *client.Client) *models.ShipmentOutput { +func createShipment(c *client.Client) *models.Shipment { // create a sending address addressFromInput := &models.AddressInput{ ObjectPurpose: models.ObjectPurposePurchase, @@ -94,7 +94,7 @@ func createShipment(c *client.Client) *models.ShipmentOutput { return shipment } -func purchaseShippingLabel(c *client.Client, shipment *models.ShipmentOutput) { +func purchaseShippingLabel(c *client.Client, shipment *models.Shipment) { transactionInput := &models.TransactionInput{ Rate: shipment.RatesList[len(shipment.RatesList)-1].ObjectID, LabelFileType: models.LabelFileTypePDF, diff --git a/models/address.go b/models/address.go index adb2df8..2a73641 100644 --- a/models/address.go +++ b/models/address.go @@ -25,7 +25,7 @@ type AddressInput struct { } // See https://goshippo.com/docs/reference#addresses -type AddressOutput struct { +type Address struct { AddressInput CommonOutputFields ObjectSource string `json:"object_source"` diff --git a/models/batch.go b/models/batch.go index 16b4e74..a6fa0f9 100644 --- a/models/batch.go +++ b/models/batch.go @@ -12,23 +12,23 @@ type BatchInput struct { } // See https://goshippo.com/docs/reference#batches -type BatchOutput struct { +type Batch struct { //BatchInput // seems that output format is slightly different CommonOutputFields - DefaultCarrierAccount string `json:"default_carrier_account,omitempty"` - DefaultServiceLevelToken string `json:"default_servicelevel_token,omitempty"` - LabelFileType string `json:"label_filetype,omitempty"` - Metadata string `json:"metadata,omitempty"` - BatchShipments *BatchOutputShipmentList `json:"batch_shipments"` - LabelURL []string `json:"label_url"` - ObjectResults *BatchObjectResults `json:"object_results"` + DefaultCarrierAccount string `json:"default_carrier_account,omitempty"` + DefaultServiceLevelToken string `json:"default_servicelevel_token,omitempty"` + LabelFileType string `json:"label_filetype,omitempty"` + Metadata string `json:"metadata,omitempty"` + BatchShipments *BatchShipmentList `json:"batch_shipments"` + LabelURL []string `json:"label_url"` + ObjectResults *BatchObjectResults `json:"object_results"` } -type BatchOutputShipmentList struct { - Count int `json:"count"` - Next string `json:"next,omitempty"` - Previous string `json:"previous,omitempty"` - Results []*BatchShipmentOutput `json:"results"` +type BatchShipmentList struct { + Count int `json:"count"` + Next string `json:"next,omitempty"` + Previous string `json:"previous,omitempty"` + Results []*BatchShipment `json:"results"` } type BatchObjectResults struct { @@ -47,7 +47,7 @@ type BatchShipmentInput struct { } // See https://goshippo.com/docs/reference#batches-batchshipments -type BatchShipmentOutput struct { +type BatchShipment struct { BatchShipmentInput CommonOutputFields Transaction string `json:"transaction"` diff --git a/models/carrier_account.go b/models/carrier_account.go index 6639c22..09121f1 100644 --- a/models/carrier_account.go +++ b/models/carrier_account.go @@ -10,7 +10,7 @@ type CarrierAccountInput struct { } // See https://goshippo.com/docs/reference#carrier-accounts -type CarrierAccountOutput struct { +type CarrierAccount struct { CarrierAccountInput CommonOutputFields } diff --git a/models/customs.go b/models/customs.go index cf1bb43..cb2c53e 100644 --- a/models/customs.go +++ b/models/customs.go @@ -39,7 +39,7 @@ type CustomsItemInput struct { } // See https://goshippo.com/docs/reference#customsitems -type CustomsItemOutput struct { +type CustomsItem struct { CustomsItemInput CommonOutputFields } @@ -65,7 +65,7 @@ type CustomsDeclarationInput struct { } // See https://goshippo.com/docs/reference#customsdeclarations -type CustomsDeclarationOutput struct { +type CustomsDeclaration struct { CustomsDeclarationInput CommonOutputFields } diff --git a/models/manifest.go b/models/manifest.go index d79056d..8e825af 100644 --- a/models/manifest.go +++ b/models/manifest.go @@ -12,7 +12,7 @@ type ManifestInput struct { } // See https://goshippo.com/docs/reference#manifests -type ManifestOutput struct { +type Manifest struct { ManifestInput CommonOutputFields } diff --git a/models/parcel.go b/models/parcel.go index ec1db31..9b54381 100644 --- a/models/parcel.go +++ b/models/parcel.go @@ -26,7 +26,7 @@ type ParcelInsurance struct { } // See https://goshippo.com/docs/reference#parcels -type ParcelOutput struct { +type Parcel struct { ParcelInput CommonOutputFields } diff --git a/models/rate.go b/models/rate.go index 6474932..e2dd724 100644 --- a/models/rate.go +++ b/models/rate.go @@ -1,7 +1,7 @@ package models // See https://goshippo.com/docs/reference#rates -type RateOutput struct { +type Rate struct { CommonOutputFields Attributes []string `json:"attributes"` AmountLocal string `json:"amount_local"` diff --git a/models/refund.go b/models/refund.go index 0d617e1..6a354da 100644 --- a/models/refund.go +++ b/models/refund.go @@ -6,7 +6,7 @@ type RefundInput struct { } // See https://goshippo.com/docs/reference#refunds -type RefundOutput struct { +type Refund struct { RefundInput CommonOutputFields } diff --git a/models/shipment.go b/models/shipment.go index 82aa84b..5f21027 100644 --- a/models/shipment.go +++ b/models/shipment.go @@ -84,11 +84,11 @@ type ShipmentBilling struct { } // See https://goshippo.com/docs/reference#shipments -type ShipmentOutput struct { +type Shipment struct { ShipmentInput CommonOutputFields ObjectStatus string `json:"object_status"` RatesURL string `json:"rates_url"` - RatesList []*RateOutput `json:"rates_list"` + RatesList []*Rate `json:"rates_list"` Messages []*OutputMessage `json:"messages"` } diff --git a/models/tracking_status.go b/models/tracking_status.go index 2a70b6c..86bdad1 100644 --- a/models/tracking_status.go +++ b/models/tracking_status.go @@ -15,7 +15,7 @@ type TrackingStatusInput struct { } // See https://goshippo.com/docs/reference#tracks -type TrackingStatusOutput struct { +type TrackingStatus struct { TrackingStatusInput TrackingStatus *TrackingStatusDict `json:"tracking_status,omitempty"` TrackingHistory []*TrackingStatusDict `json:"tracking_history,omitempty"` diff --git a/models/transaction.go b/models/transaction.go index 5aac051..43497da 100644 --- a/models/transaction.go +++ b/models/transaction.go @@ -9,7 +9,7 @@ type TransactionInput struct { } // See https://goshippo.com/docs/reference#transactions -type TransactionOutput struct { +type Transaction struct { TransactionInput CommonOutputFields ObjectStatus string `json:"object_status,omitempty"`