diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index ec89b069..6b33b232 100755 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,12 +1,12 @@ lockVersion: 2.0.0 id: 83c79445-e1aa-4008-8835-519234c13f68 management: - docChecksum: bf61704a99aaaf3476d24bb0d505a88c + docChecksum: bda7f4add5fb510fe4737e3adbe45aea docVersion: "2018-02-08" - speakeasyVersion: 1.441.2 + speakeasyVersion: 1.445.2 generationVersion: 2.461.4 - releaseVersion: 1.0.0-beta.1 - configChecksum: 8a2d90092207cde728720bd7a0fbc889 + releaseVersion: 1.0.0-beta.2 + configChecksum: 057bc6ab5654228aa14c5d86eece1a3d repoURL: https://github.com/goshippo/shippo-java-sdk.git published: true features: @@ -442,27 +442,6 @@ generatedFiles: - docs/models/webhooks/BatchResponse.md - docs/models/webhooks/TrackResponse.md - docs/models/webhooks/TransactionResponse.md - - docs/sdks/addresses/README.md - - docs/sdks/batches/README.md - - docs/sdks/carrieraccounts/README.md - - docs/sdks/carrierparceltemplates/README.md - - docs/sdks/customsdeclarations/README.md - - docs/sdks/customsitems/README.md - - docs/sdks/manifests/README.md - - docs/sdks/orders/README.md - - docs/sdks/parcels/README.md - - docs/sdks/pickups/README.md - - docs/sdks/rates/README.md - - docs/sdks/ratesatcheckout/README.md - - docs/sdks/refunds/README.md - - docs/sdks/servicegroups/README.md - - docs/sdks/shipments/README.md - - docs/sdks/shippo/README.md - - docs/sdks/shippoaccounts/README.md - - docs/sdks/trackingstatus/README.md - - docs/sdks/transactions/README.md - - docs/sdks/userparceltemplates/README.md - - docs/sdks/webhooks/README.md - gradle/wrapper/gradle-wrapper.jar - gradle/wrapper/gradle-wrapper.properties - gradlew @@ -1068,6 +1047,7 @@ examples: parameters: path: BatchId: "" + query: {} header: SHIPPO-API-VERSION: "2018-02-08" responses: diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index b2c53cf6..9a7fbf60 100755 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -13,7 +13,7 @@ generation: oAuth2ClientCredentialsEnabled: true oAuth2PasswordEnabled: false java: - version: 1.0.0-beta.1 + version: 1.0.0-beta.2 additionalDependencies: [] additionalPlugins: - id 'groovy' diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 3d3a9e4d..eea14cb6 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -1,20 +1,21 @@ -speakeasyVersion: 1.441.2 +speakeasyVersion: 1.445.2 sources: my-first-source: sourceNamespace: my-first-source - sourceRevisionDigest: sha256:b7a5f00224fde68f5c68a9f4dd3d077b0d25f491e519ffc69758b407a0e2909c - sourceBlobDigest: sha256:b267e444289e13e5381eb13cc6671b99c9498b3c6f27111df668633f7ebb7f43 + sourceRevisionDigest: sha256:2a7cd95f243d9d8389cc9ee18c5d767295321f3ee53882b8505e576a89720be8 + sourceBlobDigest: sha256:d7c076258c923e1f4b46ef44088cc063c0fb24303fd11831a44c1bf2939c684b tags: - latest - - speakeasy-sdk-regen-1732213941 + - speakeasy-sdk-regen-1732549856 + - "2018-02-08" targets: my-first-target: source: my-first-source sourceNamespace: my-first-source - sourceRevisionDigest: sha256:b7a5f00224fde68f5c68a9f4dd3d077b0d25f491e519ffc69758b407a0e2909c - sourceBlobDigest: sha256:b267e444289e13e5381eb13cc6671b99c9498b3c6f27111df668633f7ebb7f43 + sourceRevisionDigest: sha256:2a7cd95f243d9d8389cc9ee18c5d767295321f3ee53882b8505e576a89720be8 + sourceBlobDigest: sha256:d7c076258c923e1f4b46ef44088cc063c0fb24303fd11831a44c1bf2939c684b codeSamplesNamespace: my-first-source-code-samples - codeSamplesRevisionDigest: sha256:45c308b6146e78c1e75de14d33c990910dba6e191df6adb384da7a1f35aa73df + codeSamplesRevisionDigest: sha256:6ad8778ad203cf1cfc55445ef10ae13eb705f8499e663b798cdfdbe431414140 workflow: workflowVersion: 1.0.0 speakeasyVersion: latest diff --git a/README.md b/README.md index 67fa9e82..084bd26d 100644 --- a/README.md +++ b/README.md @@ -391,3 +391,10 @@ public class Application { + + + + + + + diff --git a/RELEASES.md b/RELEASES.md index 9342af75..c0a560ba 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -40,4 +40,14 @@ Based on: ### Generated - [java v1.0.0-beta.1] . ### Releases -- [Maven Central v1.0.0-beta.1] https://central.sonatype.com/artifact/com.goshippo/sdk/1.0.0-beta.1 - . \ No newline at end of file +- [Maven Central v1.0.0-beta.1] https://central.sonatype.com/artifact/com.goshippo/sdk/1.0.0-beta.1 - . + +## 2024-11-25 16:21:38 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.445.2 (2.461.4) https://github.com/speakeasy-api/speakeasy +### Generated +- [java v1.0.0-beta.2] . +### Releases +- [Maven Central v1.0.0-beta.2] https://central.sonatype.com/artifact/com.goshippo/sdk/1.0.0-beta.2 - . \ No newline at end of file diff --git a/build.gradle b/build.gradle index 65dfd9f8..4f940098 100644 --- a/build.gradle +++ b/build.gradle @@ -64,7 +64,7 @@ tasks.withType(Javadoc) { } group = "com.goshippo" -version = "1.0.0-beta.1" +version = "1.0.0-beta.2" sourcesJar { archiveBaseName = "sdk" @@ -102,7 +102,7 @@ publishing { maven(MavenPublication) { groupId = 'com.goshippo' artifactId = 'sdk' - version = '1.0.0-beta.1' + version = '1.0.0-beta.2' from components.java diff --git a/docs/models/operations/GetBatchRequest.md b/docs/models/operations/GetBatchRequest.md index 01d6cf2b..773a0b3b 100644 --- a/docs/models/operations/GetBatchRequest.md +++ b/docs/models/operations/GetBatchRequest.md @@ -6,4 +6,6 @@ | Field | Type | Required | Description | Example | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `batchId` | *String* | :heavy_check_mark: | Object ID of the batch | | +| `page` | *Optional\* | :heavy_minus_sign: | The page number you want to select | | +| `results` | *Optional\* | :heavy_minus_sign: | The number of results to return per page (max 100, default 5) | | | `shippoApiVersion` | *Optional\* | :heavy_minus_sign: | Optional string used to pick a non-default API version to use. See our API version guide. | 2018-02-08 | \ No newline at end of file diff --git a/docs/sdks/addresses/README.md b/docs/sdks/addresses/README.md deleted file mode 100644 index f687a130..00000000 --- a/docs/sdks/addresses/README.md +++ /dev/null @@ -1,236 +0,0 @@ -# Addresses -(*addresses()*) - -## Overview - -Addresses are the locations a parcel is being shipped **from** and **to**. They represent company and residential places. Among other things, you can use address objects to create shipments, calculate shipping rates, and purchase shipping labels. - - -### Available Operations - -* [list](#list) - List all addresses -* [create](#create) - Create a new address -* [get](#get) - Retrieve an address -* [validate](#validate) - Validate an address - -## list - -Returns a list of all address objects that have been created in this account. - -### Example Usage - -```java -package hello.world; - -import com.goshippo.sdk.Shippo; -import com.goshippo.sdk.models.operations.ListAddressesResponse; -import java.lang.Exception; - -public class Application { - - public static void main(String[] args) throws Exception { - - Shippo sdk = Shippo.builder() - .apiKeyHeader("") - .shippoApiVersion("2018-02-08") - .build(); - - ListAddressesResponse res = sdk.addresses().list() - .page(1L) - .results(5L) - .shippoApiVersion("2018-02-08") - .call(); - - if (res.addressPaginatedList().isPresent()) { - // handle response - } - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `page` | *Optional\* | :heavy_minus_sign: | The page number you want to select | | -| `results` | *Optional\* | :heavy_minus_sign: | The number of results to return per page (max 100, default 5) | | -| `shippoApiVersion` | *Optional\* | :heavy_minus_sign: | Optional string used to pick a non-default API version to use. See our API version guide. | 2018-02-08 | - -### Response - -**[ListAddressesResponse](../../models/operations/ListAddressesResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4XX, 5XX | \*/\* | - -## create - -Creates a new address object. You can use address objects to create new shipments, calculate rates, and to create orders. - -### Example Usage - -```java -package hello.world; - -import com.goshippo.sdk.Shippo; -import com.goshippo.sdk.models.components.AddressCreateRequest; -import com.goshippo.sdk.models.operations.CreateAddressResponse; -import java.lang.Exception; - -public class Application { - - public static void main(String[] args) throws Exception { - - Shippo sdk = Shippo.builder() - .apiKeyHeader("") - .shippoApiVersion("2018-02-08") - .build(); - - CreateAddressResponse res = sdk.addresses().create() - .shippoApiVersion("2018-02-08") - .addressCreateRequest(AddressCreateRequest.builder() - .country("US") - .name("Shwan Ippotle") - .company("Shippo") - .street1("215 Clayton St.") - .street3("") - .streetNo("") - .city("San Francisco") - .state("CA") - .zip("94117") - .phone("+1 555 341 9393") - .email("shippotle@shippo.com") - .isResidential(true) - .metadata("Customer ID 123456") - .validate(true) - .build()) - .call(); - - if (res.address().isPresent()) { - // handle response - } - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `shippoApiVersion` | *Optional\* | :heavy_minus_sign: | Optional string used to pick a non-default API version to use. See our API version guide. | 2018-02-08 | -| `addressCreateRequest` | [AddressCreateRequest](../../models/components/AddressCreateRequest.md) | :heavy_check_mark: | Address details. | | - -### Response - -**[CreateAddressResponse](../../models/operations/CreateAddressResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4XX, 5XX | \*/\* | - -## get - -Returns an existing address using an object ID. - -### Example Usage - -```java -package hello.world; - -import com.goshippo.sdk.Shippo; -import com.goshippo.sdk.models.operations.GetAddressResponse; -import java.lang.Exception; - -public class Application { - - public static void main(String[] args) throws Exception { - - Shippo sdk = Shippo.builder() - .apiKeyHeader("") - .shippoApiVersion("2018-02-08") - .build(); - - GetAddressResponse res = sdk.addresses().get() - .addressId("") - .shippoApiVersion("2018-02-08") - .call(); - - if (res.address().isPresent()) { - // handle response - } - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `addressId` | *String* | :heavy_check_mark: | Object ID of the address | | -| `shippoApiVersion` | *Optional\* | :heavy_minus_sign: | Optional string used to pick a non-default API version to use. See our API version guide. | 2018-02-08 | - -### Response - -**[GetAddressResponse](../../models/operations/GetAddressResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4XX, 5XX | \*/\* | - -## validate - -Validates an existing address using an object ID - -### Example Usage - -```java -package hello.world; - -import com.goshippo.sdk.Shippo; -import com.goshippo.sdk.models.operations.ValidateAddressResponse; -import java.lang.Exception; - -public class Application { - - public static void main(String[] args) throws Exception { - - Shippo sdk = Shippo.builder() - .apiKeyHeader("") - .shippoApiVersion("2018-02-08") - .build(); - - ValidateAddressResponse res = sdk.addresses().validate() - .addressId("") - .shippoApiVersion("2018-02-08") - .call(); - - if (res.address().isPresent()) { - // handle response - } - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `addressId` | *String* | :heavy_check_mark: | Object ID of the address | | -| `shippoApiVersion` | *Optional\* | :heavy_minus_sign: | Optional string used to pick a non-default API version to use. See our API version guide. | 2018-02-08 | - -### Response - -**[ValidateAddressResponse](../../models/operations/ValidateAddressResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/batches/README.md b/docs/sdks/batches/README.md deleted file mode 100644 index fdfa2697..00000000 --- a/docs/sdks/batches/README.md +++ /dev/null @@ -1,656 +0,0 @@ -# Batches -(*batches()*) - -## Overview - -A batch is a technique for creating multiple labels at once. Use the batch object to create and purchase many shipments in two API calls. After creating the batch, retrieve the batch to verify that all shipments are valid. You can add and remove shipments after you have created the batch. When all shipments are valid you can purchase the batch and retrieve all the shipping labels. - - -# Batch Shipment -The batch shipment object is a wrapper around a shipment object, which include shipment-specific information -for batch processing. - -Note: batch shipments can only be created on the batch endpoint, either when creating a batch object or by through -the `/batches/{BATCH_OBJECT_ID}/add_shipments` endpoint - - -### Available Operations - -* [create](#create) - Create a batch -* [get](#get) - Retrieve a batch -* [addShipments](#addshipments) - Add shipments to a batch -* [purchase](#purchase) - Purchase a batch -* [removeShipments](#removeshipments) - Remove shipments from a batch - -## create - -Creates a new batch object for purchasing shipping labels for many shipments at once. Batches are created asynchronously. This means that the API response won't include your batch shipments yet. You need to retrieve the batch later to verify that all batch shipments are valid. - -### Example Usage - -```java -package hello.world; - -import com.goshippo.sdk.Shippo; -import com.goshippo.sdk.models.components.AddressCreateRequest; -import com.goshippo.sdk.models.components.AddressFrom; -import com.goshippo.sdk.models.components.AddressReturn; -import com.goshippo.sdk.models.components.AddressTo; -import com.goshippo.sdk.models.components.BatchCreateRequest; -import com.goshippo.sdk.models.components.BatchShipmentCreateRequest; -import com.goshippo.sdk.models.components.Cod; -import com.goshippo.sdk.models.components.CustomerReference; -import com.goshippo.sdk.models.components.DepartmentNumber; -import com.goshippo.sdk.models.components.Insurance; -import com.goshippo.sdk.models.components.InvoiceNumber; -import com.goshippo.sdk.models.components.LabelFileTypeEnum; -import com.goshippo.sdk.models.components.ParcelCreateFromTemplateRequest; -import com.goshippo.sdk.models.components.ParcelExtra; -import com.goshippo.sdk.models.components.ParcelInsurance; -import com.goshippo.sdk.models.components.ParcelInsuranceProvider; -import com.goshippo.sdk.models.components.ParcelTemplateEnumSet; -import com.goshippo.sdk.models.components.ParcelTemplateFedExEnum; -import com.goshippo.sdk.models.components.Parcels; -import com.goshippo.sdk.models.components.PaymentMethod; -import com.goshippo.sdk.models.components.PoNumber; -import com.goshippo.sdk.models.components.RmaNumber; -import com.goshippo.sdk.models.components.ShipmentCreateRequest; -import com.goshippo.sdk.models.components.ShipmentCreateRequestCustomsDeclaration; -import com.goshippo.sdk.models.components.ShipmentExtra; -import com.goshippo.sdk.models.components.UPSReferenceFields; -import com.goshippo.sdk.models.components.WeightUnitEnum; -import com.goshippo.sdk.models.operations.CreateBatchResponse; -import java.lang.Exception; -import java.util.List; - -public class Application { - - public static void main(String[] args) throws Exception { - - Shippo sdk = Shippo.builder() - .apiKeyHeader("") - .shippoApiVersion("2018-02-08") - .build(); - - CreateBatchResponse res = sdk.batches().create() - .shippoApiVersion("2018-02-08") - .batchCreateRequest(BatchCreateRequest.builder() - .defaultCarrierAccount("078870331023437cb917f5187429b093") - .defaultServicelevelToken("usps_priority") - .batchShipments(List.of( - BatchShipmentCreateRequest.builder() - .shipment(ShipmentCreateRequest.builder() - .addressFrom(AddressFrom.of(AddressCreateRequest.builder() - .country("US") - .name("Shwan Ippotle") - .company("Shippo") - .street1("215 Clayton St.") - .street3("") - .streetNo("") - .city("San Francisco") - .state("CA") - .zip("94117") - .phone("+1 555 341 9393") - .email("shippotle@shippo.com") - .isResidential(true) - .metadata("Customer ID 123456") - .validate(true) - .build())) - .addressTo(AddressTo.of("d799c2679e644279b59fe661ac8fa489")) - .parcels(List.of( - Parcels.of(ParcelCreateFromTemplateRequest.builder() - .massUnit(WeightUnitEnum.LB) - .weight("1") - .template(ParcelTemplateEnumSet.of(ParcelTemplateFedExEnum.FED_EX_BOX25KG)) - .extra(ParcelExtra.builder() - .cod(Cod.builder() - .amount("5.5") - .currency("USD") - .paymentMethod(PaymentMethod.CASH) - .build()) - .insurance(ParcelInsurance.builder() - .amount("5.5") - .content("Laptop") - .currency("USD") - .provider(ParcelInsuranceProvider.UPS) - .build()) - .build()) - .metadata("Customer ID 123456") - .build()))) - .extra(ShipmentExtra.builder() - .accountsReceivableCustomerAccount(UPSReferenceFields.builder() - .prefix("ABC") - .value("value") - .refSort(1L) - .build()) - .appropriationNumber(UPSReferenceFields.builder() - .prefix("ABC") - .value("value") - .refSort(1L) - .build()) - .billOfLadingNumber(UPSReferenceFields.builder() - .prefix("ABC") - .value("value") - .refSort(1L) - .build()) - .cod(Cod.builder() - .amount("5.5") - .currency("USD") - .paymentMethod(PaymentMethod.CASH) - .build()) - .codNumber(UPSReferenceFields.builder() - .prefix("ABC") - .value("value") - .refSort(1L) - .build()) - .customerReference(CustomerReference.builder() - .refSort(1L) - .build()) - .dealerOrderNumber(UPSReferenceFields.builder() - .prefix("ABC") - .value("value") - .refSort(1L) - .build()) - .deptNumber(DepartmentNumber.builder() - .refSort(3L) - .build()) - .fdaProductCode(UPSReferenceFields.builder() - .prefix("ABC") - .value("value") - .refSort(1L) - .build()) - .insurance(Insurance.builder() - .amount("5.5") - .currency("USD") - .build()) - .invoiceNumber(InvoiceNumber.builder() - .refSort(2L) - .build()) - .manifestNumber(UPSReferenceFields.builder() - .prefix("ABC") - .value("value") - .refSort(1L) - .build()) - .modelNumber(UPSReferenceFields.builder() - .prefix("ABC") - .value("value") - .refSort(1L) - .build()) - .partNumber(UPSReferenceFields.builder() - .prefix("ABC") - .value("value") - .refSort(1L) - .build()) - .poNumber(PoNumber.builder() - .refSort(2L) - .build()) - .productionCode(UPSReferenceFields.builder() - .prefix("ABC") - .value("value") - .refSort(1L) - .build()) - .purchaseRequestNumber(UPSReferenceFields.builder() - .prefix("ABC") - .value("value") - .refSort(1L) - .build()) - .rmaNumber(RmaNumber.builder() - .refSort(1L) - .build()) - .salespersonNumber(UPSReferenceFields.builder() - .prefix("ABC") - .value("value") - .refSort(1L) - .build()) - .serialNumber(UPSReferenceFields.builder() - .prefix("ABC") - .value("value") - .refSort(1L) - .build()) - .storeNumber(UPSReferenceFields.builder() - .prefix("ABC") - .value("value") - .refSort(1L) - .build()) - .transactionReferenceNumber(UPSReferenceFields.builder() - .prefix("ABC") - .value("value") - .refSort(1L) - .build()) - .build()) - .metadata("Customer ID 123456") - .shipmentDate("2021-03-22T12:00:00Z") - .addressReturn(AddressReturn.of("d799c2679e644279b59fe661ac8fa488")) - .customsDeclaration(ShipmentCreateRequestCustomsDeclaration.of("adcfdddf8ec64b84ad22772bce3ea37a")) - .carrierAccounts(List.of( - "065a4a8c10d24a34ab932163a1b87f52", - "73f706f4bdb94b54a337563840ce52b0")) - .build()) - .carrierAccount("a4391cd4ab974f478f55dc08b5c8e3b3") - .metadata("SHIPMENT #1") - .servicelevelToken("fedex_ground") - .build())) - .labelFiletype(LabelFileTypeEnum.PDF4X6) - .metadata("BATCH #1") - .build()) - .call(); - - if (res.batch().isPresent()) { - // handle response - } - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `shippoApiVersion` | *Optional\* | :heavy_minus_sign: | Optional string used to pick a non-default API version to use. See our API version guide. | 2018-02-08 | -| `batchCreateRequest` | [BatchCreateRequest](../../models/components/BatchCreateRequest.md) | :heavy_check_mark: | Batch details. | | - -### Response - -**[CreateBatchResponse](../../models/operations/CreateBatchResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4XX, 5XX | \*/\* | - -## get - -Returns a batch using an object ID.
Batch shipments are displayed 100 at a time. You can iterate -through each `page` using the `?page= query` parameter. You can also filter based on batch shipment -status, for example, by passing a query param like `?object_results=creation_failed`.
-For more details on filtering results, see our guide on filtering. - -### Example Usage - -```java -package hello.world; - -import com.goshippo.sdk.Shippo; -import com.goshippo.sdk.models.operations.GetBatchResponse; -import java.lang.Exception; - -public class Application { - - public static void main(String[] args) throws Exception { - - Shippo sdk = Shippo.builder() - .apiKeyHeader("") - .shippoApiVersion("2018-02-08") - .build(); - - GetBatchResponse res = sdk.batches().get() - .batchId("") - .shippoApiVersion("2018-02-08") - .call(); - - if (res.batch().isPresent()) { - // handle response - } - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `batchId` | *String* | :heavy_check_mark: | Object ID of the batch | | -| `shippoApiVersion` | *Optional\* | :heavy_minus_sign: | Optional string used to pick a non-default API version to use. See our API version guide. | 2018-02-08 | - -### Response - -**[GetBatchResponse](../../models/operations/GetBatchResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4XX, 5XX | \*/\* | - -## addShipments - -Adds batch shipments to an existing batch. - -### Example Usage - -```java -package hello.world; - -import com.goshippo.sdk.Shippo; -import com.goshippo.sdk.models.components.AddressCreateRequest; -import com.goshippo.sdk.models.components.AddressFrom; -import com.goshippo.sdk.models.components.AddressReturn; -import com.goshippo.sdk.models.components.AddressTo; -import com.goshippo.sdk.models.components.BatchShipmentCreateRequest; -import com.goshippo.sdk.models.components.Cod; -import com.goshippo.sdk.models.components.CustomerReference; -import com.goshippo.sdk.models.components.DepartmentNumber; -import com.goshippo.sdk.models.components.DistanceUnitEnum; -import com.goshippo.sdk.models.components.Insurance; -import com.goshippo.sdk.models.components.InvoiceNumber; -import com.goshippo.sdk.models.components.ParcelCreateRequest; -import com.goshippo.sdk.models.components.ParcelExtra; -import com.goshippo.sdk.models.components.ParcelInsurance; -import com.goshippo.sdk.models.components.ParcelInsuranceProvider; -import com.goshippo.sdk.models.components.Parcels; -import com.goshippo.sdk.models.components.PaymentMethod; -import com.goshippo.sdk.models.components.PoNumber; -import com.goshippo.sdk.models.components.RmaNumber; -import com.goshippo.sdk.models.components.ShipmentCreateRequest; -import com.goshippo.sdk.models.components.ShipmentCreateRequestCustomsDeclaration; -import com.goshippo.sdk.models.components.ShipmentExtra; -import com.goshippo.sdk.models.components.UPSReferenceFields; -import com.goshippo.sdk.models.components.WeightUnitEnum; -import com.goshippo.sdk.models.operations.AddShipmentsToBatchResponse; -import java.lang.Exception; -import java.util.List; - -public class Application { - - public static void main(String[] args) throws Exception { - - Shippo sdk = Shippo.builder() - .apiKeyHeader("") - .shippoApiVersion("2018-02-08") - .build(); - - AddShipmentsToBatchResponse res = sdk.batches().addShipments() - .batchId("") - .shippoApiVersion("2018-02-08") - .requestBody(List.of( - BatchShipmentCreateRequest.builder() - .shipment(ShipmentCreateRequest.builder() - .addressFrom(AddressFrom.of("d799c2679e644279b59fe661ac8fa488")) - .addressTo(AddressTo.of(AddressCreateRequest.builder() - .country("US") - .name("Shwan Ippotle") - .company("Shippo") - .street1("215 Clayton St.") - .street3("") - .streetNo("") - .city("San Francisco") - .state("CA") - .zip("94117") - .phone("+1 555 341 9393") - .email("shippotle@shippo.com") - .isResidential(true) - .metadata("Customer ID 123456") - .validate(true) - .build())) - .parcels(List.of( - Parcels.of(ParcelCreateRequest.builder() - .massUnit(WeightUnitEnum.LB) - .weight("1") - .distanceUnit(DistanceUnitEnum.IN) - .height("1") - .length("1") - .width("1") - .extra(ParcelExtra.builder() - .cod(Cod.builder() - .amount("5.5") - .currency("USD") - .paymentMethod(PaymentMethod.CASH) - .build()) - .insurance(ParcelInsurance.builder() - .amount("5.5") - .content("Laptop") - .currency("USD") - .provider(ParcelInsuranceProvider.UPS) - .build()) - .build()) - .metadata("Customer ID 123456") - .build()))) - .extra(ShipmentExtra.builder() - .accountsReceivableCustomerAccount(UPSReferenceFields.builder() - .prefix("ABC") - .value("value") - .refSort(1L) - .build()) - .appropriationNumber(UPSReferenceFields.builder() - .prefix("ABC") - .value("value") - .refSort(1L) - .build()) - .billOfLadingNumber(UPSReferenceFields.builder() - .prefix("ABC") - .value("value") - .refSort(1L) - .build()) - .cod(Cod.builder() - .amount("5.5") - .currency("USD") - .paymentMethod(PaymentMethod.CASH) - .build()) - .codNumber(UPSReferenceFields.builder() - .prefix("ABC") - .value("value") - .refSort(1L) - .build()) - .customerReference(CustomerReference.builder() - .refSort(1L) - .build()) - .dealerOrderNumber(UPSReferenceFields.builder() - .prefix("ABC") - .value("value") - .refSort(1L) - .build()) - .deptNumber(DepartmentNumber.builder() - .refSort(3L) - .build()) - .fdaProductCode(UPSReferenceFields.builder() - .prefix("ABC") - .value("value") - .refSort(1L) - .build()) - .insurance(Insurance.builder() - .amount("5.5") - .currency("USD") - .build()) - .invoiceNumber(InvoiceNumber.builder() - .refSort(2L) - .build()) - .manifestNumber(UPSReferenceFields.builder() - .prefix("ABC") - .value("value") - .refSort(1L) - .build()) - .modelNumber(UPSReferenceFields.builder() - .prefix("ABC") - .value("value") - .refSort(1L) - .build()) - .partNumber(UPSReferenceFields.builder() - .prefix("ABC") - .value("value") - .refSort(1L) - .build()) - .poNumber(PoNumber.builder() - .refSort(2L) - .build()) - .productionCode(UPSReferenceFields.builder() - .prefix("ABC") - .value("value") - .refSort(1L) - .build()) - .purchaseRequestNumber(UPSReferenceFields.builder() - .prefix("ABC") - .value("value") - .refSort(1L) - .build()) - .rmaNumber(RmaNumber.builder() - .refSort(1L) - .build()) - .salespersonNumber(UPSReferenceFields.builder() - .prefix("ABC") - .value("value") - .refSort(1L) - .build()) - .serialNumber(UPSReferenceFields.builder() - .prefix("ABC") - .value("value") - .refSort(1L) - .build()) - .storeNumber(UPSReferenceFields.builder() - .prefix("ABC") - .value("value") - .refSort(1L) - .build()) - .transactionReferenceNumber(UPSReferenceFields.builder() - .prefix("ABC") - .value("value") - .refSort(1L) - .build()) - .build()) - .metadata("Customer ID 123456") - .shipmentDate("2021-03-22T12:00:00Z") - .addressReturn(AddressReturn.of("d799c2679e644279b59fe661ac8fa488")) - .customsDeclaration(ShipmentCreateRequestCustomsDeclaration.of("adcfdddf8ec64b84ad22772bce3ea37a")) - .carrierAccounts(List.of( - "065a4a8c10d24a34ab932163a1b87f52", - "73f706f4bdb94b54a337563840ce52b0")) - .build()) - .carrierAccount("a4391cd4ab974f478f55dc08b5c8e3b3") - .metadata("SHIPMENT #1") - .servicelevelToken("fedex_ground") - .build())) - .call(); - - if (res.batch().isPresent()) { - // handle response - } - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `batchId` | *String* | :heavy_check_mark: | Object ID of the batch | | -| `shippoApiVersion` | *Optional\* | :heavy_minus_sign: | Optional string used to pick a non-default API version to use. See our API version guide. | 2018-02-08 | -| `requestBody` | List\<[BatchShipmentCreateRequest](../../models/components/BatchShipmentCreateRequest.md)> | :heavy_check_mark: | Array of shipments to add to the batch | | - -### Response - -**[AddShipmentsToBatchResponse](../../models/operations/AddShipmentsToBatchResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4XX, 5XX | \*/\* | - -## purchase - -Purchases an existing batch with a status of `VALID`. -Once you send a POST request to the purchase endpoint the batch status will change to `PURCHASING`. -When all the shipments are purchased, the status will change to `PURCHASED` and you will receive a -`batch_purchased` webhook indicating that the batch has been purchased - -### Example Usage - -```java -package hello.world; - -import com.goshippo.sdk.Shippo; -import com.goshippo.sdk.models.operations.PurchaseBatchResponse; -import java.lang.Exception; - -public class Application { - - public static void main(String[] args) throws Exception { - - Shippo sdk = Shippo.builder() - .apiKeyHeader("") - .shippoApiVersion("2018-02-08") - .build(); - - PurchaseBatchResponse res = sdk.batches().purchase() - .batchId("") - .shippoApiVersion("2018-02-08") - .call(); - - if (res.batch().isPresent()) { - // handle response - } - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `batchId` | *String* | :heavy_check_mark: | Object ID of the batch | | -| `shippoApiVersion` | *Optional\* | :heavy_minus_sign: | Optional string used to pick a non-default API version to use. See our API version guide. | 2018-02-08 | - -### Response - -**[PurchaseBatchResponse](../../models/operations/PurchaseBatchResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4XX, 5XX | \*/\* | - -## removeShipments - -Removes shipments from an existing batch shipment. - -### Example Usage - -```java -package hello.world; - -import com.goshippo.sdk.Shippo; -import com.goshippo.sdk.models.operations.RemoveShipmentsFromBatchResponse; -import java.lang.Exception; -import java.util.List; - -public class Application { - - public static void main(String[] args) throws Exception { - - Shippo sdk = Shippo.builder() - .apiKeyHeader("") - .shippoApiVersion("2018-02-08") - .build(); - - RemoveShipmentsFromBatchResponse res = sdk.batches().removeShipments() - .batchId("") - .shippoApiVersion("2018-02-08") - .requestBody(List.of( - "")) - .call(); - - if (res.batch().isPresent()) { - // handle response - } - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `batchId` | *String* | :heavy_check_mark: | Object ID of the batch | | -| `shippoApiVersion` | *Optional\* | :heavy_minus_sign: | Optional string used to pick a non-default API version to use. See our API version guide. | 2018-02-08 | -| `requestBody` | List\<*String*> | :heavy_check_mark: | Array of shipments object ids to remove from the batch | | - -### Response - -**[RemoveShipmentsFromBatchResponse](../../models/operations/RemoveShipmentsFromBatchResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/carrieraccounts/README.md b/docs/sdks/carrieraccounts/README.md deleted file mode 100644 index 3aabda99..00000000 --- a/docs/sdks/carrieraccounts/README.md +++ /dev/null @@ -1,447 +0,0 @@ -# CarrierAccounts -(*carrierAccounts()*) - -## Overview - -Carriers are the companies who deliver your package. Shippo uses Carrier account objects as credentials to retrieve shipping rates and purchase labels from shipping Carriers. - - - -### Available Operations - -* [list](#list) - List all carrier accounts -* [create](#create) - Create a new carrier account -* [get](#get) - Retrieve a carrier account -* [update](#update) - Update a carrier account -* [initiateOauth2Signin](#initiateoauth2signin) - Connect an existing carrier account using OAuth 2.0 -* [register](#register) - Add a Shippo carrier account -* [getRegistrationStatus](#getregistrationstatus) - Get Carrier Registration status - -## list - -Returns a list of all carrier accounts connected to your Shippo account. These carrier accounts include both Shippo carrier accounts and your own carrier accounts that you have connected to your Shippo account. - -Additionally, you can get information about the service levels associated with each carrier account by passing in the `?service_levels=true` query parameter.
-Using it appends the property `service_levels` to each carrier account.
-By default, if the query parameter is omitted, the `service_levels` property will not be included in the response. - -### Example Usage - -```java -package hello.world; - -import com.goshippo.sdk.Shippo; -import com.goshippo.sdk.models.operations.ListCarrierAccountsRequest; -import com.goshippo.sdk.models.operations.ListCarrierAccountsResponse; -import java.lang.Exception; - -public class Application { - - public static void main(String[] args) throws Exception { - - Shippo sdk = Shippo.builder() - .apiKeyHeader("") - .shippoApiVersion("2018-02-08") - .build(); - - ListCarrierAccountsRequest req = ListCarrierAccountsRequest.builder() - .build(); - - ListCarrierAccountsResponse res = sdk.carrierAccounts().list() - .request(req) - .call(); - - if (res.carrierAccountPaginatedList().isPresent()) { - // handle response - } - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ----------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | -| `request` | [ListCarrierAccountsRequest](../../models/operations/ListCarrierAccountsRequest.md) | :heavy_check_mark: | The request object to use for the request. | - -### Response - -**[ListCarrierAccountsResponse](../../models/operations/ListCarrierAccountsResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4XX, 5XX | \*/\* | - -## create - -Creates a new carrier account or connects an existing carrier account to the Shippo account. - -### Example Usage - -```java -package hello.world; - -import com.goshippo.sdk.Shippo; -import com.goshippo.sdk.models.components.ConnectExistingOwnAccountRequest; -import com.goshippo.sdk.models.components.ConnectExistingOwnAccountRequestParameters; -import com.goshippo.sdk.models.components.FedExConnectExistingOwnAccountParameters; -import com.goshippo.sdk.models.operations.CreateCarrierAccountResponse; -import java.lang.Exception; - -public class Application { - - public static void main(String[] args) throws Exception { - - Shippo sdk = Shippo.builder() - .apiKeyHeader("") - .shippoApiVersion("2018-02-08") - .build(); - - CreateCarrierAccountResponse res = sdk.carrierAccounts().create() - .shippoApiVersion("2018-02-08") - .connectExistingOwnAccountRequest(ConnectExistingOwnAccountRequest.builder() - .accountId("321123") - .carrier("fedex") - .parameters(ConnectExistingOwnAccountRequestParameters.of(FedExConnectExistingOwnAccountParameters.builder() - .firstName("Loyal") - .lastName("Collier") - .phoneNumber("(890) 307-8579") - .fromAddressSt("") - .fromAddressCity("") - .fromAddressState("") - .fromAddressZip("") - .fromAddressCountryIso2("") - .build())) - .metadata("FEDEX Account") - .test(false) - .build()) - .call(); - - if (res.carrierAccount().isPresent()) { - // handle response - } - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `shippoApiVersion` | *Optional\* | :heavy_minus_sign: | Optional string used to pick a non-default API version to use. See our API version guide. | 2018-02-08 | -| `connectExistingOwnAccountRequest` | [ConnectExistingOwnAccountRequest](../../models/components/ConnectExistingOwnAccountRequest.md) | :heavy_check_mark: | Examples. | | - -### Response - -**[CreateCarrierAccountResponse](../../models/operations/CreateCarrierAccountResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4XX, 5XX | \*/\* | - -## get - -Returns an existing carrier account using an object ID. - -### Example Usage - -```java -package hello.world; - -import com.goshippo.sdk.Shippo; -import com.goshippo.sdk.models.operations.GetCarrierAccountResponse; -import java.lang.Exception; - -public class Application { - - public static void main(String[] args) throws Exception { - - Shippo sdk = Shippo.builder() - .apiKeyHeader("") - .shippoApiVersion("2018-02-08") - .build(); - - GetCarrierAccountResponse res = sdk.carrierAccounts().get() - .carrierAccountId("") - .shippoApiVersion("2018-02-08") - .call(); - - if (res.carrierAccount().isPresent()) { - // handle response - } - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `carrierAccountId` | *String* | :heavy_check_mark: | Object ID of the carrier account | | -| `shippoApiVersion` | *Optional\* | :heavy_minus_sign: | Optional string used to pick a non-default API version to use. See our API version guide. | 2018-02-08 | - -### Response - -**[GetCarrierAccountResponse](../../models/operations/GetCarrierAccountResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4XX, 5XX | \*/\* | - -## update - -Updates an existing carrier account object. The account_id and carrier can't be updated. This is because they form the unique identifier together. - -### Example Usage - -```java -package hello.world; - -import com.goshippo.sdk.Shippo; -import com.goshippo.sdk.models.components.CarrierAccountBase; -import com.goshippo.sdk.models.components.CarrierAccountBaseParameters; -import com.goshippo.sdk.models.components.UPSConnectExistingOwnAccountParameters; -import com.goshippo.sdk.models.operations.UpdateCarrierAccountResponse; -import java.lang.Exception; - -public class Application { - - public static void main(String[] args) throws Exception { - - Shippo sdk = Shippo.builder() - .apiKeyHeader("") - .shippoApiVersion("2018-02-08") - .build(); - - UpdateCarrierAccountResponse res = sdk.carrierAccounts().update() - .carrierAccountId("") - .shippoApiVersion("2018-02-08") - .carrierAccountBase(CarrierAccountBase.builder() - .accountId("****") - .carrier("usps") - .parameters(CarrierAccountBaseParameters.of(UPSConnectExistingOwnAccountParameters.builder() - .accountNumber("94567e") - .billingAddressCity("San Francisco") - .billingAddressCountryIso2("US") - .billingAddressState("CA") - .billingAddressStreet1("731 Market St") - .billingAddressZip("94103") - .collecCountryIso2("US") - .collecZip("94103") - .company("Shippo") - .email("hippo@shippo.com") - .fullName("Shippo Meister") - .hasInvoice(false) - .phone("1112223333") - .title("Manager") - .upsAgreements(false) - .aiaCountryIso2("US") - .billingAddressStreet2("STE 200") - .currencyCode("USD") - .invoiceControlid("1234") - .invoiceDate("20210529") - .invoiceNumber("1112234") - .invoiceValue("11.23") - .build())) - .build()) - .call(); - - if (res.carrierAccount().isPresent()) { - // handle response - } - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `carrierAccountId` | *String* | :heavy_check_mark: | Object ID of the carrier account | | -| `shippoApiVersion` | *Optional\* | :heavy_minus_sign: | Optional string used to pick a non-default API version to use. See our API version guide. | 2018-02-08 | -| `carrierAccountBase` | [Optional\](../../models/components/CarrierAccountBase.md) | :heavy_minus_sign: | Examples. | | - -### Response - -**[UpdateCarrierAccountResponse](../../models/operations/UpdateCarrierAccountResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4XX, 5XX | \*/\* | - -## initiateOauth2Signin - -Used by client applications to setup or reconnect an existing carrier account with carriers that support OAuth 2.0 - -### Example Usage - -```java -package hello.world; - -import com.goshippo.sdk.Shippo; -import com.goshippo.sdk.models.errors.InitiateOauth2SigninCarrierAccountsResponseBody; -import com.goshippo.sdk.models.errors.InitiateOauth2SigninCarrierAccountsResponseResponseBody; -import com.goshippo.sdk.models.errors.InitiateOauth2SigninResponseBody; -import com.goshippo.sdk.models.operations.InitiateOauth2SigninResponse; -import java.lang.Exception; - -public class Application { - - public static void main(String[] args) throws InitiateOauth2SigninResponseBody, InitiateOauth2SigninCarrierAccountsResponseBody, InitiateOauth2SigninCarrierAccountsResponseResponseBody, Exception { - - Shippo sdk = Shippo.builder() - .apiKeyHeader("") - .shippoApiVersion("2018-02-08") - .build(); - - InitiateOauth2SigninResponse res = sdk.carrierAccounts().initiateOauth2Signin() - .carrierAccountObjectId("") - .redirectUri("https://enlightened-mortise.com/") - .state("Louisiana") - .shippoApiVersion("2018-02-08") - .call(); - - // handle response - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | Example | -| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `carrierAccountObjectId` | *String* | :heavy_check_mark: | The carrier account ID (UUID) to start a signin process. | | -| `redirectUri` | *String* | :heavy_check_mark: | Callback URL. The URL that tells the authorization server where to send the user back to after they approve the request. | | -| `state` | *Optional\* | :heavy_minus_sign: | A random string generated by the consuming application and included in the request to prevent CSRF attacks. The consuming application checks that the same value is returned after the user authorizes Shippo. | | -| `shippoApiVersion` | *Optional\* | :heavy_minus_sign: | Optional string used to pick a non-default API version to use. See our API version guide. | 2018-02-08 | - -### Response - -**[InitiateOauth2SigninResponse](../../models/operations/InitiateOauth2SigninResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | -| models/errors/InitiateOauth2SigninResponseBody | 400 | application/json | -| models/errors/InitiateOauth2SigninCarrierAccountsResponseBody | 401 | application/json | -| models/errors/InitiateOauth2SigninCarrierAccountsResponseResponseBody | 404 | application/json | -| models/errors/SDKError | 4XX, 5XX | \*/\* | - -## register - -Adds a Shippo carrier account - -### Example Usage - -```java -package hello.world; - -import com.goshippo.sdk.Shippo; -import com.goshippo.sdk.models.components.CarrierAccountCorreosCreateRequest; -import com.goshippo.sdk.models.components.CarrierAccountCorreosCreateRequestParameters; -import com.goshippo.sdk.models.operations.RegisterCarrierAccountRequestBody; -import com.goshippo.sdk.models.operations.RegisterCarrierAccountResponse; -import java.lang.Exception; - -public class Application { - - public static void main(String[] args) throws Exception { - - Shippo sdk = Shippo.builder() - .apiKeyHeader("") - .shippoApiVersion("2018-02-08") - .build(); - - RegisterCarrierAccountResponse res = sdk.carrierAccounts().register() - .shippoApiVersion("2018-02-08") - .requestBody(RegisterCarrierAccountRequestBody.of(CarrierAccountCorreosCreateRequest.builder() - .carrier("correos") - .parameters(CarrierAccountCorreosCreateRequestParameters.builder() - .build()) - .build())) - .call(); - - if (res.carrierAccount().isPresent()) { - // handle response - } - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `shippoApiVersion` | *Optional\* | :heavy_minus_sign: | Optional string used to pick a non-default API version to use. See our API version guide. | 2018-02-08 | -| `requestBody` | [RegisterCarrierAccountRequestBody](../../models/operations/RegisterCarrierAccountRequestBody.md) | :heavy_check_mark: | Examples. | | - -### Response - -**[RegisterCarrierAccountResponse](../../models/operations/RegisterCarrierAccountResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4XX, 5XX | \*/\* | - -## getRegistrationStatus - -Returns the registration status for the given account for the given carrier - -### Example Usage - -```java -package hello.world; - -import com.goshippo.sdk.Shippo; -import com.goshippo.sdk.models.operations.Carrier; -import com.goshippo.sdk.models.operations.GetCarrierRegistrationStatusResponse; -import java.lang.Exception; - -public class Application { - - public static void main(String[] args) throws Exception { - - Shippo sdk = Shippo.builder() - .apiKeyHeader("") - .shippoApiVersion("2018-02-08") - .build(); - - GetCarrierRegistrationStatusResponse res = sdk.carrierAccounts().getRegistrationStatus() - .carrier(Carrier.USPS) - .shippoApiVersion("2018-02-08") - .call(); - - if (res.carrierAccountRegistrationStatus().isPresent()) { - // handle response - } - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `carrier` | [Carrier](../../models/operations/Carrier.md) | :heavy_check_mark: | filter by specific carrier | | -| `shippoApiVersion` | *Optional\* | :heavy_minus_sign: | Optional string used to pick a non-default API version to use. See our API version guide. | 2018-02-08 | - -### Response - -**[GetCarrierRegistrationStatusResponse](../../models/operations/GetCarrierRegistrationStatusResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/carrierparceltemplates/README.md b/docs/sdks/carrierparceltemplates/README.md deleted file mode 100644 index 79b98781..00000000 --- a/docs/sdks/carrierparceltemplates/README.md +++ /dev/null @@ -1,124 +0,0 @@ -# CarrierParcelTemplates -(*carrierParcelTemplates()*) - -## Overview - -A carrier parcel template represents a package used for shipping that has preset dimensions defined by a carrier. Some examples of a carrier parcel template include USPS Flat Rate Box and Fedex Small Pak. When using a carrier parcel template, the rates returned may be limited to the carrier that provides the box. You can create user parcel templates using a carrier parcel template. Shippo takes the dimensions of the carrier parcel template but you must configure the weight. - - - -### Available Operations - -* [list](#list) - List all carrier parcel templates -* [get](#get) - Retrieve a carrier parcel templates - -## list - -List all carrier parcel template objects.
Use the following query string params to filter the results as needed.
-
    -
  • `include=all` (the default). Includes templates from all carriers
  • -
  • `include=user`. Includes templates only from carriers which the user has added (whether or not they're currently enabled)
  • -
  • `include=enabled`. includes templates only for carriers which the user has added and enabled
  • -
  • `carrier=*token*`. filter by specific carrier, e.g. fedex, usps
  • -
- -### Example Usage - -```java -package hello.world; - -import com.goshippo.sdk.Shippo; -import com.goshippo.sdk.models.operations.Include; -import com.goshippo.sdk.models.operations.ListCarrierParcelTemplatesResponse; -import java.lang.Exception; - -public class Application { - - public static void main(String[] args) throws Exception { - - Shippo sdk = Shippo.builder() - .apiKeyHeader("") - .shippoApiVersion("2018-02-08") - .build(); - - ListCarrierParcelTemplatesResponse res = sdk.carrierParcelTemplates().list() - .include(Include.ENABLED) - .carrier("fedex") - .shippoApiVersion("2018-02-08") - .call(); - - if (res.carrierParcelTemplateList().isPresent()) { - // handle response - } - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `include` | [Optional\](../../models/operations/Include.md) | :heavy_minus_sign: | filter by user or enabled | | -| `carrier` | *Optional\* | :heavy_minus_sign: | filter by specific carrier | fedex | -| `shippoApiVersion` | *Optional\* | :heavy_minus_sign: | Optional string used to pick a non-default API version to use. See our API version guide. | 2018-02-08 | - -### Response - -**[ListCarrierParcelTemplatesResponse](../../models/operations/ListCarrierParcelTemplatesResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4XX, 5XX | \*/\* | - -## get - -Fetches the parcel template information for a specific carrier parcel template, identified by the token. - -### Example Usage - -```java -package hello.world; - -import com.goshippo.sdk.Shippo; -import com.goshippo.sdk.models.operations.GetCarrierParcelTemplateResponse; -import java.lang.Exception; - -public class Application { - - public static void main(String[] args) throws Exception { - - Shippo sdk = Shippo.builder() - .apiKeyHeader("") - .shippoApiVersion("2018-02-08") - .build(); - - GetCarrierParcelTemplateResponse res = sdk.carrierParcelTemplates().get() - .carrierParcelTemplateToken("") - .shippoApiVersion("2018-02-08") - .call(); - - if (res.carrierParcelTemplate().isPresent()) { - // handle response - } - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `carrierParcelTemplateToken` | *String* | :heavy_check_mark: | The unique string representation of the carrier parcel template | | -| `shippoApiVersion` | *Optional\* | :heavy_minus_sign: | Optional string used to pick a non-default API version to use. See our API version guide. | 2018-02-08 | - -### Response - -**[GetCarrierParcelTemplateResponse](../../models/operations/GetCarrierParcelTemplateResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/customsdeclarations/README.md b/docs/sdks/customsdeclarations/README.md deleted file mode 100644 index 012399af..00000000 --- a/docs/sdks/customsdeclarations/README.md +++ /dev/null @@ -1,242 +0,0 @@ -# CustomsDeclarations -(*customsDeclarations()*) - -## Overview - -Customs declarations are relevant information, including one or multiple customs items, you need to provide for -customs clearance for your international shipments. - - -### Available Operations - -* [list](#list) - List all customs declarations -* [create](#create) - Create a new customs declaration -* [get](#get) - Retrieve a customs declaration - -## list - -Returns a a list of all customs declaration objects - -### Example Usage - -```java -package hello.world; - -import com.goshippo.sdk.Shippo; -import com.goshippo.sdk.models.operations.ListCustomsDeclarationsResponse; -import java.lang.Exception; - -public class Application { - - public static void main(String[] args) throws Exception { - - Shippo sdk = Shippo.builder() - .apiKeyHeader("") - .shippoApiVersion("2018-02-08") - .build(); - - ListCustomsDeclarationsResponse res = sdk.customsDeclarations().list() - .page(1L) - .results(5L) - .shippoApiVersion("2018-02-08") - .call(); - - if (res.customsDeclarationPaginatedList().isPresent()) { - // handle response - } - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `page` | *Optional\* | :heavy_minus_sign: | The page number you want to select | | -| `results` | *Optional\* | :heavy_minus_sign: | The number of results to return per page (max 100, default 5) | | -| `shippoApiVersion` | *Optional\* | :heavy_minus_sign: | Optional string used to pick a non-default API version to use. See our API version guide. | 2018-02-08 | - -### Response - -**[ListCustomsDeclarationsResponse](../../models/operations/ListCustomsDeclarationsResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4XX, 5XX | \*/\* | - -## create - -Creates a new customs declaration object - -### Example Usage - -```java -package hello.world; - -import com.goshippo.sdk.Shippo; -import com.goshippo.sdk.models.components.AddressImporter; -import com.goshippo.sdk.models.components.CustomsDeclarationB13AFilingOptionEnum; -import com.goshippo.sdk.models.components.CustomsDeclarationContentsTypeEnum; -import com.goshippo.sdk.models.components.CustomsDeclarationCreateRequest; -import com.goshippo.sdk.models.components.CustomsDeclarationCreateRequestAddress; -import com.goshippo.sdk.models.components.CustomsDeclarationCreateRequestType; -import com.goshippo.sdk.models.components.CustomsDeclarationEelPfcEnum; -import com.goshippo.sdk.models.components.CustomsDeclarationIncotermEnum; -import com.goshippo.sdk.models.components.CustomsDeclarationNonDeliveryOptionEnum; -import com.goshippo.sdk.models.components.CustomsExporterIdentification; -import com.goshippo.sdk.models.components.CustomsItemCreateRequest; -import com.goshippo.sdk.models.components.CustomsTaxIdentification; -import com.goshippo.sdk.models.components.CustomsTaxIdentificationType; -import com.goshippo.sdk.models.components.DutiesPayor; -import com.goshippo.sdk.models.components.WeightUnitEnum; -import com.goshippo.sdk.models.operations.CreateCustomsDeclarationResponse; -import java.lang.Exception; -import java.util.List; - -public class Application { - - public static void main(String[] args) throws Exception { - - Shippo sdk = Shippo.builder() - .apiKeyHeader("") - .shippoApiVersion("2018-02-08") - .build(); - - CreateCustomsDeclarationResponse res = sdk.customsDeclarations().create() - .shippoApiVersion("2018-02-08") - .customsDeclarationCreateRequest(CustomsDeclarationCreateRequest.builder() - .certify(true) - .certifySigner("Shawn Ippotle") - .contentsType(CustomsDeclarationContentsTypeEnum.MERCHANDISE) - .items(List.of( - CustomsItemCreateRequest.builder() - .description("T-Shirt") - .massUnit(WeightUnitEnum.LB) - .netWeight("5") - .originCountry("") - .quantity(20L) - .valueAmount("200") - .valueCurrency("USD") - .metadata("Order ID \"123454\"") - .skuCode("HM-123") - .hsCode("0901.21") - .build())) - .nonDeliveryOption(CustomsDeclarationNonDeliveryOptionEnum.RETURN) - .b13aFilingOption(CustomsDeclarationB13AFilingOptionEnum.FILED_ELECTRONICALLY) - .contentsExplanation("T-Shirt purchase") - .dutiesPayor(DutiesPayor.builder() - .account("2323434543") - .type(CustomsDeclarationCreateRequestType.THIRD_PARTY) - .address(CustomsDeclarationCreateRequestAddress.builder() - .name("Patrick Kavanagh") - .zip("80331") - .country("DE") - .build()) - .build()) - .exporterIdentification(CustomsExporterIdentification.builder() - .eoriNumber("PL123456790ABCDE") - .taxId(CustomsTaxIdentification.builder() - .number("123456789") - .type(CustomsTaxIdentificationType.EIN) - .build()) - .build()) - .invoice("#123123") - .metadata("Order ID #123123") - .addressImporter(AddressImporter.builder() - .name("Shwan Ippotle") - .company("Shippo") - .street1("Blumenstraße") - .street3("") - .streetNo("22") - .city("München") - .state("CA") - .zip("80331") - .country("DE") - .phone("80331") - .email("shippotle@shippo.com") - .isResidential(true) - .build()) - .eelPfc(CustomsDeclarationEelPfcEnum.NOEEI3037_A) - .incoterm(CustomsDeclarationIncotermEnum.DDP) - .test(true) - .build()) - .call(); - - if (res.customsDeclaration().isPresent()) { - // handle response - } - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `shippoApiVersion` | *Optional\* | :heavy_minus_sign: | Optional string used to pick a non-default API version to use. See our API version guide. | 2018-02-08 | -| `customsDeclarationCreateRequest` | [CustomsDeclarationCreateRequest](../../models/components/CustomsDeclarationCreateRequest.md) | :heavy_check_mark: | CustomsDeclaration details. | | - -### Response - -**[CreateCustomsDeclarationResponse](../../models/operations/CreateCustomsDeclarationResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4XX, 5XX | \*/\* | - -## get - -Returns an existing customs declaration using an object ID - -### Example Usage - -```java -package hello.world; - -import com.goshippo.sdk.Shippo; -import com.goshippo.sdk.models.operations.GetCustomsDeclarationResponse; -import java.lang.Exception; - -public class Application { - - public static void main(String[] args) throws Exception { - - Shippo sdk = Shippo.builder() - .apiKeyHeader("") - .shippoApiVersion("2018-02-08") - .build(); - - GetCustomsDeclarationResponse res = sdk.customsDeclarations().get() - .customsDeclarationId("") - .page(1L) - .shippoApiVersion("2018-02-08") - .call(); - - if (res.customsDeclaration().isPresent()) { - // handle response - } - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `customsDeclarationId` | *String* | :heavy_check_mark: | Object ID of the customs declaration | | -| `page` | *Optional\* | :heavy_minus_sign: | The page number you want to select | | -| `shippoApiVersion` | *Optional\* | :heavy_minus_sign: | Optional string used to pick a non-default API version to use. See our API version guide. | 2018-02-08 | - -### Response - -**[GetCustomsDeclarationResponse](../../models/operations/GetCustomsDeclarationResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/customsitems/README.md b/docs/sdks/customsitems/README.md deleted file mode 100644 index 3e9ac652..00000000 --- a/docs/sdks/customsitems/README.md +++ /dev/null @@ -1,183 +0,0 @@ -# CustomsItems -(*customsItems()*) - -## Overview - -Customs declarations are relevant information, including one or multiple customs items, you need to provide for customs clearance for your international shipments. - - -### Available Operations - -* [list](#list) - List all customs items -* [create](#create) - Create a new customs item -* [get](#get) - Retrieve a customs item - -## list - -Returns a list all customs items objects. - -### Example Usage - -```java -package hello.world; - -import com.goshippo.sdk.Shippo; -import com.goshippo.sdk.models.operations.ListCustomsItemsResponse; -import java.lang.Exception; - -public class Application { - - public static void main(String[] args) throws Exception { - - Shippo sdk = Shippo.builder() - .apiKeyHeader("") - .shippoApiVersion("2018-02-08") - .build(); - - ListCustomsItemsResponse res = sdk.customsItems().list() - .page(1L) - .results(25L) - .shippoApiVersion("2018-02-08") - .call(); - - if (res.customsItemPaginatedList().isPresent()) { - // handle response - } - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `page` | *Optional\* | :heavy_minus_sign: | The page number you want to select | | -| `results` | *Optional\* | :heavy_minus_sign: | The number of results to return per page (max 100) | | -| `shippoApiVersion` | *Optional\* | :heavy_minus_sign: | Optional string used to pick a non-default API version to use. See our API version guide. | 2018-02-08 | - -### Response - -**[ListCustomsItemsResponse](../../models/operations/ListCustomsItemsResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4XX, 5XX | \*/\* | - -## create - -Creates a new customs item object. - -### Example Usage - -```java -package hello.world; - -import com.goshippo.sdk.Shippo; -import com.goshippo.sdk.models.components.CustomsItemCreateRequest; -import com.goshippo.sdk.models.components.WeightUnitEnum; -import com.goshippo.sdk.models.operations.CreateCustomsItemResponse; -import java.lang.Exception; - -public class Application { - - public static void main(String[] args) throws Exception { - - Shippo sdk = Shippo.builder() - .apiKeyHeader("") - .shippoApiVersion("2018-02-08") - .build(); - - CreateCustomsItemResponse res = sdk.customsItems().create() - .shippoApiVersion("2018-02-08") - .customsItemCreateRequest(CustomsItemCreateRequest.builder() - .description("T-Shirt") - .massUnit(WeightUnitEnum.LB) - .netWeight("5") - .originCountry("") - .quantity(20L) - .valueAmount("200") - .valueCurrency("USD") - .metadata("Order ID \"123454\"") - .skuCode("HM-123") - .hsCode("0901.21") - .build()) - .call(); - - if (res.customsItem().isPresent()) { - // handle response - } - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `shippoApiVersion` | *Optional\* | :heavy_minus_sign: | Optional string used to pick a non-default API version to use. See our API version guide. | 2018-02-08 | -| `customsItemCreateRequest` | [CustomsItemCreateRequest](../../models/components/CustomsItemCreateRequest.md) | :heavy_check_mark: | CustomsItem details. | | - -### Response - -**[CreateCustomsItemResponse](../../models/operations/CreateCustomsItemResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4XX, 5XX | \*/\* | - -## get - -Returns an existing customs item using an object ID - -### Example Usage - -```java -package hello.world; - -import com.goshippo.sdk.Shippo; -import com.goshippo.sdk.models.operations.GetCustomsItemResponse; -import java.lang.Exception; - -public class Application { - - public static void main(String[] args) throws Exception { - - Shippo sdk = Shippo.builder() - .apiKeyHeader("") - .shippoApiVersion("2018-02-08") - .build(); - - GetCustomsItemResponse res = sdk.customsItems().get() - .customsItemId("") - .page(1L) - .shippoApiVersion("2018-02-08") - .call(); - - if (res.customsItem().isPresent()) { - // handle response - } - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `customsItemId` | *String* | :heavy_check_mark: | Object ID of the customs item | | -| `page` | *Optional\* | :heavy_minus_sign: | The page number you want to select | | -| `shippoApiVersion` | *Optional\* | :heavy_minus_sign: | Optional string used to pick a non-default API version to use. See our API version guide. | 2018-02-08 | - -### Response - -**[GetCustomsItemResponse](../../models/operations/GetCustomsItemResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/manifests/README.md b/docs/sdks/manifests/README.md deleted file mode 100644 index b8f8388e..00000000 --- a/docs/sdks/manifests/README.md +++ /dev/null @@ -1,199 +0,0 @@ -# Manifests -(*manifests()*) - -## Overview - -A manifest is a single-page document with a barcode that carriers can scan to accept all packages into transit without the need to scan each item individually. -They are close-outs of shipping labels of a certain day. Some carriers require manifests to process the shipments. - - - -# Manifest Errors -The following codes and messages are the possible errors that may occur when creating Manifests. - - -### Available Operations - -* [list](#list) - List all manifests -* [create](#create) - Create a new manifest -* [get](#get) - Retrieve a manifest - -## list - -Returns a list of all manifest objects. - -### Example Usage - -```java -package hello.world; - -import com.goshippo.sdk.Shippo; -import com.goshippo.sdk.models.operations.ListManifestsResponse; -import java.lang.Exception; - -public class Application { - - public static void main(String[] args) throws Exception { - - Shippo sdk = Shippo.builder() - .apiKeyHeader("") - .shippoApiVersion("2018-02-08") - .build(); - - ListManifestsResponse res = sdk.manifests().list() - .page(1L) - .results(5L) - .shippoApiVersion("2018-02-08") - .call(); - - if (res.manifestPaginatedList().isPresent()) { - // handle response - } - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `page` | *Optional\* | :heavy_minus_sign: | The page number you want to select | | -| `results` | *Optional\* | :heavy_minus_sign: | The number of results to return per page (max 100, default 5) | | -| `shippoApiVersion` | *Optional\* | :heavy_minus_sign: | Optional string used to pick a non-default API version to use. See our API version guide. | 2018-02-08 | - -### Response - -**[ListManifestsResponse](../../models/operations/ListManifestsResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4XX, 5XX | \*/\* | - -## create - -Creates a new manifest object. - -### Example Usage - -```java -package hello.world; - -import com.goshippo.sdk.Shippo; -import com.goshippo.sdk.models.components.AddressCreateRequest; -import com.goshippo.sdk.models.components.ManifestCreateRequest; -import com.goshippo.sdk.models.components.ManifestCreateRequestAddressFrom; -import com.goshippo.sdk.models.operations.CreateManifestResponse; -import java.lang.Exception; -import java.util.List; - -public class Application { - - public static void main(String[] args) throws Exception { - - Shippo sdk = Shippo.builder() - .apiKeyHeader("") - .shippoApiVersion("2018-02-08") - .build(); - - CreateManifestResponse res = sdk.manifests().create() - .shippoApiVersion("2018-02-08") - .manifestCreateRequest(ManifestCreateRequest.builder() - .carrierAccount("adcfdddf8ec64b84ad22772bce3ea37a") - .shipmentDate("2014-05-16T23:59:59Z") - .addressFrom(ManifestCreateRequestAddressFrom.of(AddressCreateRequest.builder() - .country("US") - .name("Shwan Ippotle") - .company("Shippo") - .street1("215 Clayton St.") - .street3("") - .streetNo("") - .city("San Francisco") - .state("CA") - .zip("94117") - .phone("+1 555 341 9393") - .email("shippotle@shippo.com") - .isResidential(true) - .metadata("Customer ID 123456") - .validate(true) - .build())) - .transactions(List.of( - "adcfdddf8ec64b84ad22772bce3ea37a")) - .build()) - .call(); - - if (res.manifest().isPresent()) { - // handle response - } - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `shippoApiVersion` | *Optional\* | :heavy_minus_sign: | Optional string used to pick a non-default API version to use. See our API version guide. | 2018-02-08 | -| `manifestCreateRequest` | [ManifestCreateRequest](../../models/components/ManifestCreateRequest.md) | :heavy_check_mark: | Manifest details and contact info. | | - -### Response - -**[CreateManifestResponse](../../models/operations/CreateManifestResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4XX, 5XX | \*/\* | - -## get - -Returns an existing manifest using an object ID. - -### Example Usage - -```java -package hello.world; - -import com.goshippo.sdk.Shippo; -import com.goshippo.sdk.models.operations.GetManifestResponse; -import java.lang.Exception; - -public class Application { - - public static void main(String[] args) throws Exception { - - Shippo sdk = Shippo.builder() - .apiKeyHeader("") - .shippoApiVersion("2018-02-08") - .build(); - - GetManifestResponse res = sdk.manifests().get() - .manifestId("") - .shippoApiVersion("2018-02-08") - .call(); - - if (res.manifest().isPresent()) { - // handle response - } - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `manifestId` | *String* | :heavy_check_mark: | Object ID of the manifest to update | | -| `shippoApiVersion` | *Optional\* | :heavy_minus_sign: | Optional string used to pick a non-default API version to use. See our API version guide. | 2018-02-08 | - -### Response - -**[GetManifestResponse](../../models/operations/GetManifestResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/orders/README.md b/docs/sdks/orders/README.md deleted file mode 100644 index 2cea4e97..00000000 --- a/docs/sdks/orders/README.md +++ /dev/null @@ -1,252 +0,0 @@ -# Orders -(*orders()*) - -## Overview - -An order is a request from a customer to purchase goods from a merchant. -Use the orders object to load orders from your system to the Shippo dashboard. -You can use the orders object to create, retrieve, list, and manage orders programmatically. -You can also retrieve shipping rates, purchase labels, and track shipments for each order. - - -# Line Item -

-
Line Items, and their corresponding abstract Products and Variants, might be exposed as a separate resource - in the future. Currently it's a nested object within the order resource.

-

- A line item is an individual object in an order. For example, if your order contains a t-shirt, shorts, and a jacket, each item is represented by a line item. - - -### Available Operations - -* [list](#list) - List all orders -* [create](#create) - Create a new order -* [get](#get) - Retrieve an order - -## list - -Returns a list of all order objects. - -### Example Usage - -```java -package hello.world; - -import com.goshippo.sdk.Shippo; -import com.goshippo.sdk.models.components.OrderShopAppEnum; -import com.goshippo.sdk.models.components.OrderStatusEnum; -import com.goshippo.sdk.models.operations.ListOrdersRequest; -import com.goshippo.sdk.models.operations.ListOrdersResponse; -import java.lang.Exception; -import java.util.List; - -public class Application { - - public static void main(String[] args) throws Exception { - - Shippo sdk = Shippo.builder() - .apiKeyHeader("") - .shippoApiVersion("2018-02-08") - .build(); - - ListOrdersRequest req = ListOrdersRequest.builder() - .orderStatus(List.of( - OrderStatusEnum.PAID)) - .shopApp(OrderShopAppEnum.SHIPPO) - .build(); - - ListOrdersResponse res = sdk.orders().list() - .request(req) - .call(); - - if (res.orderPaginatedList().isPresent()) { - // handle response - } - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | -| `request` | [ListOrdersRequest](../../models/operations/ListOrdersRequest.md) | :heavy_check_mark: | The request object to use for the request. | - -### Response - -**[ListOrdersResponse](../../models/operations/ListOrdersResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4XX, 5XX | \*/\* | - -## create - -Creates a new order object. - -### Example Usage - -```java -package hello.world; - -import com.goshippo.sdk.Shippo; -import com.goshippo.sdk.models.components.AddressCreateRequest; -import com.goshippo.sdk.models.components.LineItemBase; -import com.goshippo.sdk.models.components.OrderCreateRequest; -import com.goshippo.sdk.models.components.OrderStatusEnum; -import com.goshippo.sdk.models.components.WeightUnitEnum; -import com.goshippo.sdk.models.operations.CreateOrderResponse; -import java.lang.Exception; -import java.time.OffsetDateTime; -import java.util.List; - -public class Application { - - public static void main(String[] args) throws Exception { - - Shippo sdk = Shippo.builder() - .apiKeyHeader("") - .shippoApiVersion("2018-02-08") - .build(); - - CreateOrderResponse res = sdk.orders().create() - .shippoApiVersion("2018-02-08") - .orderCreateRequest(OrderCreateRequest.builder() - .placedAt("2016-09-23T01:28:12Z") - .toAddress(AddressCreateRequest.builder() - .country("US") - .name("Shwan Ippotle") - .company("Shippo") - .street1("215 Clayton St.") - .street3("") - .streetNo("") - .city("San Francisco") - .state("CA") - .zip("94117") - .phone("+1 555 341 9393") - .email("shippotle@shippo.com") - .isResidential(true) - .metadata("Customer ID 123456") - .validate(true) - .build()) - .currency("USD") - .notes("This customer is a VIP") - .orderNumber("#1068") - .orderStatus(OrderStatusEnum.PAID) - .shippingCost("12.83") - .shippingCostCurrency("USD") - .shippingMethod("USPS First Class Package") - .subtotalPrice("12.1") - .totalPrice("24.93") - .totalTax("0.0") - .weight("0.4") - .weightUnit(WeightUnitEnum.LB) - .fromAddress(AddressCreateRequest.builder() - .country("US") - .name("Shwan Ippotle") - .company("Shippo") - .street1("215 Clayton St.") - .street3("") - .streetNo("") - .city("San Francisco") - .state("CA") - .zip("94117") - .phone("+1 555 341 9393") - .email("shippotle@shippo.com") - .isResidential(true) - .metadata("Customer ID 123456") - .validate(true) - .build()) - .lineItems(List.of( - LineItemBase.builder() - .currency("USD") - .manufactureCountry("US") - .maxDeliveryTime(OffsetDateTime.parse("2016-07-23T00:00:00Z")) - .maxShipTime(OffsetDateTime.parse("2016-07-23T00:00:00Z")) - .quantity(20L) - .sku("HM-123") - .title("Hippo Magazines") - .totalPrice("12.1") - .variantTitle("June Edition") - .weight("0.4") - .weightUnit(WeightUnitEnum.LB) - .build())) - .build()) - .call(); - - if (res.order().isPresent()) { - // handle response - } - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `shippoApiVersion` | *Optional\* | :heavy_minus_sign: | Optional string used to pick a non-default API version to use. See our API version guide. | 2018-02-08 | -| `orderCreateRequest` | [OrderCreateRequest](../../models/components/OrderCreateRequest.md) | :heavy_check_mark: | Order details. | | - -### Response - -**[CreateOrderResponse](../../models/operations/CreateOrderResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4XX, 5XX | \*/\* | - -## get - -Retrieves an existing order using an object ID. - -### Example Usage - -```java -package hello.world; - -import com.goshippo.sdk.Shippo; -import com.goshippo.sdk.models.operations.GetOrderResponse; -import java.lang.Exception; - -public class Application { - - public static void main(String[] args) throws Exception { - - Shippo sdk = Shippo.builder() - .apiKeyHeader("") - .shippoApiVersion("2018-02-08") - .build(); - - GetOrderResponse res = sdk.orders().get() - .orderId("") - .shippoApiVersion("2018-02-08") - .call(); - - if (res.order().isPresent()) { - // handle response - } - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `orderId` | *String* | :heavy_check_mark: | Object ID of the order | | -| `shippoApiVersion` | *Optional\* | :heavy_minus_sign: | Optional string used to pick a non-default API version to use. See our API version guide. | 2018-02-08 | - -### Response - -**[GetOrderResponse](../../models/operations/GetOrderResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/parcels/README.md b/docs/sdks/parcels/README.md deleted file mode 100644 index e0e8ebc2..00000000 --- a/docs/sdks/parcels/README.md +++ /dev/null @@ -1,202 +0,0 @@ -# Parcels -(*parcels()*) - -## Overview - -A parcel is an item you are shipping. The parcel object includes details about its physical make-up of the parcel. It includes dimensions and weight that Shippo uses to calculate rates. - - -# Parcel Extras -The following values are supported for the `extra` field of the parcel object. - - -### Available Operations - -* [list](#list) - List all parcels -* [create](#create) - Create a new parcel -* [get](#get) - Retrieve an existing parcel - -## list - -Returns a list of all parcel objects. - -### Example Usage - -```java -package hello.world; - -import com.goshippo.sdk.Shippo; -import com.goshippo.sdk.models.operations.ListParcelsResponse; -import java.lang.Exception; - -public class Application { - - public static void main(String[] args) throws Exception { - - Shippo sdk = Shippo.builder() - .apiKeyHeader("") - .shippoApiVersion("2018-02-08") - .build(); - - ListParcelsResponse res = sdk.parcels().list() - .page(1L) - .results(25L) - .shippoApiVersion("2018-02-08") - .call(); - - if (res.parcelPaginatedList().isPresent()) { - // handle response - } - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `page` | *Optional\* | :heavy_minus_sign: | The page number you want to select | | -| `results` | *Optional\* | :heavy_minus_sign: | The number of results to return per page (max 100) | | -| `shippoApiVersion` | *Optional\* | :heavy_minus_sign: | Optional string used to pick a non-default API version to use. See our API version guide. | 2018-02-08 | - -### Response - -**[ListParcelsResponse](../../models/operations/ListParcelsResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4XX, 5XX | \*/\* | - -## create - -Creates a new parcel object. - -### Example Usage - -```java -package hello.world; - -import com.goshippo.sdk.Shippo; -import com.goshippo.sdk.models.components.Cod; -import com.goshippo.sdk.models.components.DistanceUnitEnum; -import com.goshippo.sdk.models.components.ParcelCreateRequest; -import com.goshippo.sdk.models.components.ParcelExtra; -import com.goshippo.sdk.models.components.ParcelInsurance; -import com.goshippo.sdk.models.components.ParcelInsuranceProvider; -import com.goshippo.sdk.models.components.PaymentMethod; -import com.goshippo.sdk.models.components.WeightUnitEnum; -import com.goshippo.sdk.models.operations.CreateParcelRequestBody; -import com.goshippo.sdk.models.operations.CreateParcelResponse; -import java.lang.Exception; - -public class Application { - - public static void main(String[] args) throws Exception { - - Shippo sdk = Shippo.builder() - .apiKeyHeader("") - .shippoApiVersion("2018-02-08") - .build(); - - CreateParcelResponse res = sdk.parcels().create() - .shippoApiVersion("2018-02-08") - .requestBody(CreateParcelRequestBody.of(ParcelCreateRequest.builder() - .massUnit(WeightUnitEnum.LB) - .weight("1") - .distanceUnit(DistanceUnitEnum.IN) - .height("1") - .length("1") - .width("1") - .extra(ParcelExtra.builder() - .cod(Cod.builder() - .amount("5.5") - .currency("USD") - .paymentMethod(PaymentMethod.CASH) - .build()) - .insurance(ParcelInsurance.builder() - .amount("5.5") - .content("Laptop") - .currency("USD") - .provider(ParcelInsuranceProvider.UPS) - .build()) - .build()) - .metadata("Customer ID 123456") - .build())) - .call(); - - if (res.parcel().isPresent()) { - // handle response - } - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `shippoApiVersion` | *Optional\* | :heavy_minus_sign: | Optional string used to pick a non-default API version to use. See our API version guide. | 2018-02-08 | -| `requestBody` | [CreateParcelRequestBody](../../models/operations/CreateParcelRequestBody.md) | :heavy_check_mark: | Parcel details. | | - -### Response - -**[CreateParcelResponse](../../models/operations/CreateParcelResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4XX, 5XX | \*/\* | - -## get - -Returns parcel details using an existing parcel object ID (this will not return parcel details associated with un-purchased shipment/rate parcel object IDs). - -### Example Usage - -```java -package hello.world; - -import com.goshippo.sdk.Shippo; -import com.goshippo.sdk.models.operations.GetParcelResponse; -import java.lang.Exception; - -public class Application { - - public static void main(String[] args) throws Exception { - - Shippo sdk = Shippo.builder() - .apiKeyHeader("") - .shippoApiVersion("2018-02-08") - .build(); - - GetParcelResponse res = sdk.parcels().get() - .parcelId("") - .shippoApiVersion("2018-02-08") - .call(); - - if (res.parcel().isPresent()) { - // handle response - } - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `parcelId` | *String* | :heavy_check_mark: | Object ID of the parcel | | -| `shippoApiVersion` | *Optional\* | :heavy_minus_sign: | Optional string used to pick a non-default API version to use. See our API version guide. | 2018-02-08 | - -### Response - -**[GetParcelResponse](../../models/operations/GetParcelResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/pickups/README.md b/docs/sdks/pickups/README.md deleted file mode 100644 index de53e502..00000000 --- a/docs/sdks/pickups/README.md +++ /dev/null @@ -1,97 +0,0 @@ -# Pickups -(*pickups()*) - -## Overview - -A pickup is when you schedule a carrier to collect a package for delivery. -Use Shippo’s pickups endpoint to schedule pickups with USPS and DHL Express for eligible shipments that you have already created. - - -### Available Operations - -* [create](#create) - Create a pickup - -## create - -Creates a pickup object. This request is for a carrier to come to a specified location to take a package for shipping. - -### Example Usage - -```java -package hello.world; - -import com.goshippo.sdk.Shippo; -import com.goshippo.sdk.models.components.AddressCompleteCreateRequest; -import com.goshippo.sdk.models.components.BuildingLocationType; -import com.goshippo.sdk.models.components.BuildingType; -import com.goshippo.sdk.models.components.Location; -import com.goshippo.sdk.models.components.PickupBase; -import com.goshippo.sdk.models.operations.CreatePickupResponse; -import java.lang.Exception; -import java.time.OffsetDateTime; -import java.util.List; - -public class Application { - - public static void main(String[] args) throws Exception { - - Shippo sdk = Shippo.builder() - .apiKeyHeader("") - .shippoApiVersion("2018-02-08") - .build(); - - CreatePickupResponse res = sdk.pickups().create() - .shippoApiVersion("2018-02-08") - .pickupBase(PickupBase.builder() - .carrierAccount("adcfdddf8ec64b84ad22772bce3ea37a") - .location(Location.builder() - .address(AddressCompleteCreateRequest.builder() - .name("Shwan Ippotle") - .street1("215 Clayton St.") - .city("San Francisco") - .state("CA") - .zip("94117") - .country("US") - .company("Shippo") - .street3("") - .streetNo("") - .phone("+1 555 341 9393") - .email("shippotle@shippo.com") - .isResidential(true) - .metadata("Customer ID 123456") - .validate(true) - .build()) - .buildingLocationType(BuildingLocationType.FRONT_DOOR) - .buildingType(BuildingType.APARTMENT) - .instructions("Behind screen door") - .build()) - .requestedEndTime(OffsetDateTime.parse("2023-06-18T07:14:55.338Z")) - .requestedStartTime(OffsetDateTime.parse("2023-12-01T17:06:07.804Z")) - .transactions(List.of( - "adcfdddf8ec64b84ad22772bce3ea37a")) - .build()) - .call(); - - if (res.pickup().isPresent()) { - // handle response - } - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `shippoApiVersion` | *Optional\* | :heavy_minus_sign: | Optional string used to pick a non-default API version to use. See our API version guide. | 2018-02-08 | -| `pickupBase` | [PickupBase](../../models/components/PickupBase.md) | :heavy_check_mark: | Shippo’s pickups endpoint allows you to schedule pickups with USPS and DHL Express for eligible shipments that you have already created. | | - -### Response - -**[CreatePickupResponse](../../models/operations/CreatePickupResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/rates/README.md b/docs/sdks/rates/README.md deleted file mode 100644 index 853a7872..00000000 --- a/docs/sdks/rates/README.md +++ /dev/null @@ -1,180 +0,0 @@ -# Rates -(*rates()*) - -## Overview - -A rate is the cost to ship a parcel from a carrier. The rate object details the service level including the cost and transit time. - - -### Available Operations - -* [get](#get) - Retrieve a rate -* [listShipmentRates](#listshipmentrates) - Retrieve shipment rates -* [listShipmentRatesByCurrencyCode](#listshipmentratesbycurrencycode) - Retrieve shipment rates in currency - -## get - -Returns an existing rate using a rate object ID. - -### Example Usage - -```java -package hello.world; - -import com.goshippo.sdk.Shippo; -import com.goshippo.sdk.models.operations.GetRateResponse; -import java.lang.Exception; - -public class Application { - - public static void main(String[] args) throws Exception { - - Shippo sdk = Shippo.builder() - .apiKeyHeader("") - .shippoApiVersion("2018-02-08") - .build(); - - GetRateResponse res = sdk.rates().get() - .rateId("") - .shippoApiVersion("2018-02-08") - .call(); - - if (res.rate().isPresent()) { - // handle response - } - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `rateId` | *String* | :heavy_check_mark: | Object ID of the rate | | -| `shippoApiVersion` | *Optional\* | :heavy_minus_sign: | Optional string used to pick a non-default API version to use. See our API version guide. | 2018-02-08 | - -### Response - -**[GetRateResponse](../../models/operations/GetRateResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4XX, 5XX | \*/\* | - -## listShipmentRates - -Returns a paginated list of rates associated with a shipment - -### Example Usage - -```java -package hello.world; - -import com.goshippo.sdk.Shippo; -import com.goshippo.sdk.models.operations.ListShipmentRatesResponse; -import java.lang.Exception; - -public class Application { - - public static void main(String[] args) throws Exception { - - Shippo sdk = Shippo.builder() - .apiKeyHeader("") - .shippoApiVersion("2018-02-08") - .build(); - - ListShipmentRatesResponse res = sdk.rates().listShipmentRates() - .shipmentId("") - .page(1L) - .results(25L) - .shippoApiVersion("2018-02-08") - .call(); - - if (res.ratePaginatedList().isPresent()) { - // handle response - } - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `shipmentId` | *String* | :heavy_check_mark: | Object ID of the shipment to update | | -| `page` | *Optional\* | :heavy_minus_sign: | The page number you want to select | | -| `results` | *Optional\* | :heavy_minus_sign: | The number of results to return per page (max 100) | | -| `shippoApiVersion` | *Optional\* | :heavy_minus_sign: | Optional string used to pick a non-default API version to use. See our API version guide. | 2018-02-08 | - -### Response - -**[ListShipmentRatesResponse](../../models/operations/ListShipmentRatesResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4XX, 5XX | \*/\* | - -## listShipmentRatesByCurrencyCode - -Returns all available shipping rates for a shipment object. - -When you create a new valid shipment object, Shippo automatically calculates all available rates. Depending on your shipment data, there may be none, one or multiple rates. - -By default, the calculated rates will return the price in two currencies under the `amount` and `amount_local` keys, respectively. The `amount` key will contain the price of a rate expressed in the currency that is used in the country from where the parcel originates, and the `amount_local` key will contain the price expressed in the currency that is used in the country the parcel is shipped to. You can request rates with prices expressed in a different currency by adding the currency code to the end of the resource URL. The full list of supported currencies along with their codes can be viewed on open exchange rates. - -Note: re-requesting the rates with a different currency code will re-queue the shipment (i.e. set the Shipment's `status` to `QUEUED`) and the converted currency rates will only be available when the Shipment's `status` is set to `SUCCESS`. - -### Example Usage - -```java -package hello.world; - -import com.goshippo.sdk.Shippo; -import com.goshippo.sdk.models.operations.ListShipmentRatesByCurrencyCodeRequest; -import com.goshippo.sdk.models.operations.ListShipmentRatesByCurrencyCodeResponse; -import java.lang.Exception; - -public class Application { - - public static void main(String[] args) throws Exception { - - Shippo sdk = Shippo.builder() - .apiKeyHeader("") - .shippoApiVersion("2018-02-08") - .build(); - - ListShipmentRatesByCurrencyCodeRequest req = ListShipmentRatesByCurrencyCodeRequest.builder() - .shipmentId("") - .currencyCode("USD") - .build(); - - ListShipmentRatesByCurrencyCodeResponse res = sdk.rates().listShipmentRatesByCurrencyCode() - .request(req) - .call(); - - if (res.ratePaginatedList().isPresent()) { - // handle response - } - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | -| `request` | [ListShipmentRatesByCurrencyCodeRequest](../../models/operations/ListShipmentRatesByCurrencyCodeRequest.md) | :heavy_check_mark: | The request object to use for the request. | - -### Response - -**[ListShipmentRatesByCurrencyCodeResponse](../../models/operations/ListShipmentRatesByCurrencyCodeResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/ratesatcheckout/README.md b/docs/sdks/ratesatcheckout/README.md deleted file mode 100644 index 2020e56e..00000000 --- a/docs/sdks/ratesatcheckout/README.md +++ /dev/null @@ -1,268 +0,0 @@ -# RatesAtCheckout -(*ratesAtCheckout()*) - -## Overview - -Rates at checkout is a tool for merchants to display up-to-date shipping estimates based on what's in their customers cart and where they’re shipping to. -Merchants set up curated shipping options for customers in the checkout flow based on data in the shopping cart. The request must include the **to** address and item information. Optional fields are the **from** address and package information. If the optional fields are not included, the service will use the default address and/or package configured for rates at checkout. The response is a list of shipping options based on the Service Group configuration. -(see Service Group configuration for details). - - - -# Default Parcel Template -Assign one of your user parcel templates to be the default used when generating Live Rates. This template will be used by default when generating Live Rates, unless you explicitly provide a parcel in the Live Rates request. - - -### Available Operations - -* [create](#create) - Generate a live rates request -* [getDefaultParcelTemplate](#getdefaultparceltemplate) - Show current default parcel template -* [updateDefaultParcelTemplate](#updatedefaultparceltemplate) - Update default parcel template -* [deleteDefaultParcelTemplate](#deletedefaultparceltemplate) - Clear current default parcel template - -## create - -Initiates a live rates request. Include either the object ID for -an existing address record or a fully formed address object when entering -an address value. You can also enter the object ID of an existing user parcel -template or a fully formed user parcel template object as the parcel value. - -### Example Usage - -```java -package hello.world; - -import com.goshippo.sdk.Shippo; -import com.goshippo.sdk.models.components.AddressCompleteCreateRequest; -import com.goshippo.sdk.models.components.LineItem; -import com.goshippo.sdk.models.components.LiveRateCreateRequest; -import com.goshippo.sdk.models.components.LiveRateCreateRequestAddressFrom; -import com.goshippo.sdk.models.components.LiveRateCreateRequestAddressTo; -import com.goshippo.sdk.models.components.LiveRateCreateRequestParcel; -import com.goshippo.sdk.models.components.WeightUnitEnum; -import com.goshippo.sdk.models.operations.CreateLiveRateResponse; -import java.lang.Exception; -import java.time.OffsetDateTime; -import java.util.List; - -public class Application { - - public static void main(String[] args) throws Exception { - - Shippo sdk = Shippo.builder() - .apiKeyHeader("") - .shippoApiVersion("2018-02-08") - .build(); - - CreateLiveRateResponse res = sdk.ratesAtCheckout().create() - .shippoApiVersion("2018-02-08") - .liveRateCreateRequest(LiveRateCreateRequest.builder() - .addressTo(LiveRateCreateRequestAddressTo.of("")) - .lineItems(List.of( - LineItem.builder() - .currency("USD") - .manufactureCountry("US") - .maxDeliveryTime(OffsetDateTime.parse("2016-07-23T00:00:00Z")) - .maxShipTime(OffsetDateTime.parse("2016-07-23T00:00:00Z")) - .quantity(20L) - .sku("HM-123") - .title("Hippo Magazines") - .totalPrice("12.1") - .variantTitle("June Edition") - .weight("0.4") - .weightUnit(WeightUnitEnum.LB) - .objectId("abf7d5675d744b6ea9fdb6f796b28f28") - .build())) - .addressFrom(LiveRateCreateRequestAddressFrom.of(AddressCompleteCreateRequest.builder() - .name("Shwan Ippotle") - .street1("215 Clayton St.") - .city("San Francisco") - .state("CA") - .zip("94117") - .country("US") - .company("Shippo") - .street3("") - .streetNo("") - .phone("+1 555 341 9393") - .email("shippotle@shippo.com") - .isResidential(true) - .metadata("Customer ID 123456") - .validate(true) - .build())) - .parcel(LiveRateCreateRequestParcel.of("5df144dca289442cv7a06")) - .build()) - .call(); - - if (res.liveRatePaginatedList().isPresent()) { - // handle response - } - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `shippoApiVersion` | *Optional\* | :heavy_minus_sign: | Optional string used to pick a non-default API version to use. See our API version guide. | 2018-02-08 | -| `liveRateCreateRequest` | [LiveRateCreateRequest](../../models/components/LiveRateCreateRequest.md) | :heavy_check_mark: | Generate rates at checkout | | - -### Response - -**[CreateLiveRateResponse](../../models/operations/CreateLiveRateResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4XX, 5XX | \*/\* | - -## getDefaultParcelTemplate - -Retrieve and display the currently configured default parcel template for live rates. - -### Example Usage - -```java -package hello.world; - -import com.goshippo.sdk.Shippo; -import com.goshippo.sdk.models.operations.GetDefaultParcelTemplateResponse; -import java.lang.Exception; - -public class Application { - - public static void main(String[] args) throws Exception { - - Shippo sdk = Shippo.builder() - .apiKeyHeader("") - .shippoApiVersion("2018-02-08") - .build(); - - GetDefaultParcelTemplateResponse res = sdk.ratesAtCheckout().getDefaultParcelTemplate() - .shippoApiVersion("2018-02-08") - .call(); - - if (res.defaultParcelTemplate().isPresent()) { - // handle response - } - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `shippoApiVersion` | *Optional\* | :heavy_minus_sign: | Optional string used to pick a non-default API version to use. See our API version guide. | 2018-02-08 | - -### Response - -**[GetDefaultParcelTemplateResponse](../../models/operations/GetDefaultParcelTemplateResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4XX, 5XX | \*/\* | - -## updateDefaultParcelTemplate - -Update the currently configured default parcel template for live rates. The object_id in the request payload should identify the user parcel template to be the new default. - -### Example Usage - -```java -package hello.world; - -import com.goshippo.sdk.Shippo; -import com.goshippo.sdk.models.components.DefaultParcelTemplateUpdateRequest; -import com.goshippo.sdk.models.operations.UpdateDefaultParcelTemplateResponse; -import java.lang.Exception; - -public class Application { - - public static void main(String[] args) throws Exception { - - Shippo sdk = Shippo.builder() - .apiKeyHeader("") - .shippoApiVersion("2018-02-08") - .build(); - - UpdateDefaultParcelTemplateResponse res = sdk.ratesAtCheckout().updateDefaultParcelTemplate() - .shippoApiVersion("2018-02-08") - .defaultParcelTemplateUpdateRequest(DefaultParcelTemplateUpdateRequest.builder() - .objectId("b958d3690bb04bb8b2986724872750f5") - .build()) - .call(); - - if (res.defaultParcelTemplate().isPresent()) { - // handle response - } - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `shippoApiVersion` | *Optional\* | :heavy_minus_sign: | Optional string used to pick a non-default API version to use. See our API version guide. | 2018-02-08 | -| `defaultParcelTemplateUpdateRequest` | [Optional\](../../models/components/DefaultParcelTemplateUpdateRequest.md) | :heavy_minus_sign: | N/A | | - -### Response - -**[UpdateDefaultParcelTemplateResponse](../../models/operations/UpdateDefaultParcelTemplateResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4XX, 5XX | \*/\* | - -## deleteDefaultParcelTemplate - -Clears the currently configured default parcel template for live rates. - -### Example Usage - -```java -package hello.world; - -import com.goshippo.sdk.Shippo; -import com.goshippo.sdk.models.operations.DeleteDefaultParcelTemplateResponse; -import java.lang.Exception; - -public class Application { - - public static void main(String[] args) throws Exception { - - Shippo sdk = Shippo.builder() - .apiKeyHeader("") - .shippoApiVersion("2018-02-08") - .build(); - - DeleteDefaultParcelTemplateResponse res = sdk.ratesAtCheckout().deleteDefaultParcelTemplate() - .shippoApiVersion("2018-02-08") - .call(); - - // handle response - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `shippoApiVersion` | *Optional\* | :heavy_minus_sign: | Optional string used to pick a non-default API version to use. See our API version guide. | 2018-02-08 | - -### Response - -**[DeleteDefaultParcelTemplateResponse](../../models/operations/DeleteDefaultParcelTemplateResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/refunds/README.md b/docs/sdks/refunds/README.md deleted file mode 100644 index 7cfe2626..00000000 --- a/docs/sdks/refunds/README.md +++ /dev/null @@ -1,168 +0,0 @@ -# Refunds -(*refunds()*) - -## Overview - -Refunds are reimbursements for successfully created but unused shipping labels or other charges. - - -### Available Operations - -* [create](#create) - Create a refund -* [list](#list) - List all refunds -* [get](#get) - Retrieve a refund - -## create - -Creates a new refund object. - -### Example Usage - -```java -package hello.world; - -import com.goshippo.sdk.Shippo; -import com.goshippo.sdk.models.components.RefundRequestBody; -import com.goshippo.sdk.models.operations.CreateRefundResponse; -import java.lang.Exception; - -public class Application { - - public static void main(String[] args) throws Exception { - - Shippo sdk = Shippo.builder() - .apiKeyHeader("") - .shippoApiVersion("2018-02-08") - .build(); - - CreateRefundResponse res = sdk.refunds().create() - .shippoApiVersion("2018-02-08") - .refundRequestBody(RefundRequestBody.builder() - .transaction("915d94940ea54c3a80cbfa328722f5a1") - .async(false) - .build()) - .call(); - - if (res.refund().isPresent()) { - // handle response - } - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `shippoApiVersion` | *Optional\* | :heavy_minus_sign: | Optional string used to pick a non-default API version to use. See our API version guide. | 2018-02-08 | -| `refundRequestBody` | [RefundRequestBody](../../models/components/RefundRequestBody.md) | :heavy_check_mark: | Refund details | | - -### Response - -**[CreateRefundResponse](../../models/operations/CreateRefundResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4XX, 5XX | \*/\* | - -## list - -Returns a list all refund objects. - -### Example Usage - -```java -package hello.world; - -import com.goshippo.sdk.Shippo; -import com.goshippo.sdk.models.operations.ListRefundsResponse; -import java.lang.Exception; - -public class Application { - - public static void main(String[] args) throws Exception { - - Shippo sdk = Shippo.builder() - .apiKeyHeader("") - .shippoApiVersion("2018-02-08") - .build(); - - ListRefundsResponse res = sdk.refunds().list() - .shippoApiVersion("2018-02-08") - .call(); - - if (res.refundPaginatedList().isPresent()) { - // handle response - } - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `shippoApiVersion` | *Optional\* | :heavy_minus_sign: | Optional string used to pick a non-default API version to use. See our API version guide. | 2018-02-08 | - -### Response - -**[ListRefundsResponse](../../models/operations/ListRefundsResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4XX, 5XX | \*/\* | - -## get - -Returns an existing rate using a rate object ID. - -### Example Usage - -```java -package hello.world; - -import com.goshippo.sdk.Shippo; -import com.goshippo.sdk.models.operations.GetRefundResponse; -import java.lang.Exception; - -public class Application { - - public static void main(String[] args) throws Exception { - - Shippo sdk = Shippo.builder() - .apiKeyHeader("") - .shippoApiVersion("2018-02-08") - .build(); - - GetRefundResponse res = sdk.refunds().get() - .refundId("") - .shippoApiVersion("2018-02-08") - .call(); - - if (res.refund().isPresent()) { - // handle response - } - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `refundId` | *String* | :heavy_check_mark: | Object ID of the refund to update | | -| `shippoApiVersion` | *Optional\* | :heavy_minus_sign: | Optional string used to pick a non-default API version to use. See our API version guide. | 2018-02-08 | - -### Response - -**[GetRefundResponse](../../models/operations/GetRefundResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/servicegroups/README.md b/docs/sdks/servicegroups/README.md deleted file mode 100644 index b948cf81..00000000 --- a/docs/sdks/servicegroups/README.md +++ /dev/null @@ -1,253 +0,0 @@ -# ServiceGroups -(*serviceGroups()*) - -## Overview - -A service group is a set of service levels grouped together. -Rates at checkout uses services groups to present available shipping options to customers in their shopping basket. - - -### Available Operations - -* [list](#list) - List all service groups -* [create](#create) - Create a new service group -* [update](#update) - Update an existing service group -* [delete](#delete) - Delete a service group - -## list - -Returns a list of service group objects. - -### Example Usage - -```java -package hello.world; - -import com.goshippo.sdk.Shippo; -import com.goshippo.sdk.models.operations.ListServiceGroupsResponse; -import java.lang.Exception; - -public class Application { - - public static void main(String[] args) throws Exception { - - Shippo sdk = Shippo.builder() - .apiKeyHeader("") - .shippoApiVersion("2018-02-08") - .build(); - - ListServiceGroupsResponse res = sdk.serviceGroups().list() - .shippoApiVersion("2018-02-08") - .call(); - - if (res.serviceGroupListResponse().isPresent()) { - // handle response - } - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `shippoApiVersion` | *Optional\* | :heavy_minus_sign: | Optional string used to pick a non-default API version to use. See our API version guide. | 2018-02-08 | - -### Response - -**[ListServiceGroupsResponse](../../models/operations/ListServiceGroupsResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4XX, 5XX | \*/\* | - -## create - -Creates a new service group. - -### Example Usage - -```java -package hello.world; - -import com.goshippo.sdk.Shippo; -import com.goshippo.sdk.models.components.ServiceGroupAccountAndServiceLevel; -import com.goshippo.sdk.models.components.ServiceGroupCreateRequest; -import com.goshippo.sdk.models.components.ServiceGroupTypeEnum; -import com.goshippo.sdk.models.operations.CreateServiceGroupResponse; -import java.lang.Exception; -import java.util.List; - -public class Application { - - public static void main(String[] args) throws Exception { - - Shippo sdk = Shippo.builder() - .apiKeyHeader("") - .shippoApiVersion("2018-02-08") - .build(); - - CreateServiceGroupResponse res = sdk.serviceGroups().create() - .shippoApiVersion("2018-02-08") - .serviceGroupCreateRequest(ServiceGroupCreateRequest.builder() - .description("USPS shipping options") - .name("USPS Shipping") - .type(ServiceGroupTypeEnum.FLAT_RATE) - .serviceLevels(List.of( - ServiceGroupAccountAndServiceLevel.builder() - .accountObjectId("80feb1633d4a43c898f0058506cfd82d") - .serviceLevelToken("ups_next_day_air_saver") - .build())) - .flatRate("5") - .flatRateCurrency("USD") - .freeShippingThresholdCurrency("USD") - .freeShippingThresholdMin("5") - .rateAdjustment(15L) - .build()) - .call(); - - if (res.serviceGroup().isPresent()) { - // handle response - } - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `shippoApiVersion` | *Optional\* | :heavy_minus_sign: | Optional string used to pick a non-default API version to use. See our API version guide. | 2018-02-08 | -| `serviceGroupCreateRequest` | [ServiceGroupCreateRequest](../../models/components/ServiceGroupCreateRequest.md) | :heavy_check_mark: | N/A | | - -### Response - -**[CreateServiceGroupResponse](../../models/operations/CreateServiceGroupResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4XX, 5XX | \*/\* | - -## update - -Updates an existing service group object.
The object_id cannot be updated as it is the unique identifier for the object. - -### Example Usage - -```java -package hello.world; - -import com.goshippo.sdk.Shippo; -import com.goshippo.sdk.models.components.ServiceGroupAccountAndServiceLevel; -import com.goshippo.sdk.models.components.ServiceGroupTypeEnum; -import com.goshippo.sdk.models.components.ServiceGroupUpdateRequest; -import com.goshippo.sdk.models.operations.UpdateServiceGroupResponse; -import java.lang.Exception; -import java.util.List; - -public class Application { - - public static void main(String[] args) throws Exception { - - Shippo sdk = Shippo.builder() - .apiKeyHeader("") - .shippoApiVersion("2018-02-08") - .build(); - - UpdateServiceGroupResponse res = sdk.serviceGroups().update() - .shippoApiVersion("2018-02-08") - .serviceGroupUpdateRequest(ServiceGroupUpdateRequest.builder() - .description("USPS shipping options") - .name("USPS Shipping") - .type(ServiceGroupTypeEnum.FLAT_RATE) - .objectId("80feb1633d4a43c898f005850") - .isActive(true) - .serviceLevels(List.of( - ServiceGroupAccountAndServiceLevel.builder() - .accountObjectId("80feb1633d4a43c898f0058506cfd82d") - .serviceLevelToken("ups_next_day_air_saver") - .build())) - .flatRate("5") - .flatRateCurrency("USD") - .freeShippingThresholdCurrency("USD") - .freeShippingThresholdMin("5") - .rateAdjustment(15L) - .build()) - .call(); - - if (res.serviceGroup().isPresent()) { - // handle response - } - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `shippoApiVersion` | *Optional\* | :heavy_minus_sign: | Optional string used to pick a non-default API version to use. See our API version guide. | 2018-02-08 | -| `serviceGroupUpdateRequest` | [Optional\](../../models/components/ServiceGroupUpdateRequest.md) | :heavy_minus_sign: | N/A | | - -### Response - -**[UpdateServiceGroupResponse](../../models/operations/UpdateServiceGroupResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4XX, 5XX | \*/\* | - -## delete - -Deletes an existing service group using an object ID. - -### Example Usage - -```java -package hello.world; - -import com.goshippo.sdk.Shippo; -import com.goshippo.sdk.models.operations.DeleteServiceGroupResponse; -import java.lang.Exception; - -public class Application { - - public static void main(String[] args) throws Exception { - - Shippo sdk = Shippo.builder() - .apiKeyHeader("") - .shippoApiVersion("2018-02-08") - .build(); - - DeleteServiceGroupResponse res = sdk.serviceGroups().delete() - .serviceGroupId("") - .shippoApiVersion("2018-02-08") - .call(); - - // handle response - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `serviceGroupId` | *String* | :heavy_check_mark: | Object ID of the service group | | -| `shippoApiVersion` | *Optional\* | :heavy_minus_sign: | Optional string used to pick a non-default API version to use. See our API version guide. | 2018-02-08 | - -### Response - -**[DeleteServiceGroupResponse](../../models/operations/DeleteServiceGroupResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/shipments/README.md b/docs/sdks/shipments/README.md deleted file mode 100644 index 32f25a70..00000000 --- a/docs/sdks/shipments/README.md +++ /dev/null @@ -1,360 +0,0 @@ -# Shipments -(*shipments()*) - -## Overview - -A shipment is the act of transporting goods. A shipment object contains **to** and **from** addresses, and the parcel details that you are shipping. You can use the shipment object to retrieve shipping rates and purchase a shipping label. - - -# Shipment Extras -The following values are supported for the `extra` field of the shipment object. - - -### Available Operations - -* [list](#list) - List all shipments -* [create](#create) - Create a new shipment -* [get](#get) - Retrieve a shipment - -## list - -Returns a list of all shipment objects.

-In order to filter results, you must use the below path parameters. -A maximum date range of 90 days is permitted. -Provided dates should be ISO 8601 UTC dates (timezone offsets are currently not supported).

- -Optional path parameters:
- `object_created_gt`- object(s) created greater than a provided date time
- `object_created_gte` - object(s) created greater than or equal to a provided date time
- `object_created_lt` - object(s) created less than a provided date time
- `object_created_lte` - object(s) created less than or equal to a provided date time
- - Date format examples:
- `2017-01-01`
- `2017-01-01T03:30:30` or `2017-01-01T03:30:30.5`
- `2017-01-01T03:30:30Z`

- - Example URL:
- `https://api.goshippo.com/shipments/?object_created_gte=2017-01-01T00:00:30&object_created_lt=2017-04-01T00:00:30` - -### Example Usage - -```java -package hello.world; - -import com.goshippo.sdk.Shippo; -import com.goshippo.sdk.models.operations.ListShipmentsRequest; -import com.goshippo.sdk.models.operations.ListShipmentsResponse; -import java.lang.Exception; - -public class Application { - - public static void main(String[] args) throws Exception { - - Shippo sdk = Shippo.builder() - .apiKeyHeader("") - .shippoApiVersion("2018-02-08") - .build(); - - ListShipmentsRequest req = ListShipmentsRequest.builder() - .build(); - - ListShipmentsResponse res = sdk.shipments().list() - .request(req) - .call(); - - if (res.shipmentPaginatedList().isPresent()) { - // handle response - } - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | -| `request` | [ListShipmentsRequest](../../models/operations/ListShipmentsRequest.md) | :heavy_check_mark: | The request object to use for the request. | - -### Response - -**[ListShipmentsResponse](../../models/operations/ListShipmentsResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4XX, 5XX | \*/\* | - -## create - -Creates a new shipment object. - -### Example Usage - -```java -package hello.world; - -import com.goshippo.sdk.Shippo; -import com.goshippo.sdk.models.components.AddressCreateRequest; -import com.goshippo.sdk.models.components.AddressFrom; -import com.goshippo.sdk.models.components.AddressReturn; -import com.goshippo.sdk.models.components.AddressTo; -import com.goshippo.sdk.models.components.Cod; -import com.goshippo.sdk.models.components.CustomerReference; -import com.goshippo.sdk.models.components.DepartmentNumber; -import com.goshippo.sdk.models.components.Insurance; -import com.goshippo.sdk.models.components.InvoiceNumber; -import com.goshippo.sdk.models.components.ParcelCreateFromTemplateRequest; -import com.goshippo.sdk.models.components.ParcelExtra; -import com.goshippo.sdk.models.components.ParcelInsurance; -import com.goshippo.sdk.models.components.ParcelInsuranceProvider; -import com.goshippo.sdk.models.components.ParcelTemplateEnumSet; -import com.goshippo.sdk.models.components.ParcelTemplateFedExEnum; -import com.goshippo.sdk.models.components.Parcels; -import com.goshippo.sdk.models.components.PaymentMethod; -import com.goshippo.sdk.models.components.PoNumber; -import com.goshippo.sdk.models.components.RmaNumber; -import com.goshippo.sdk.models.components.ShipmentCreateRequest; -import com.goshippo.sdk.models.components.ShipmentCreateRequestCustomsDeclaration; -import com.goshippo.sdk.models.components.ShipmentExtra; -import com.goshippo.sdk.models.components.UPSReferenceFields; -import com.goshippo.sdk.models.components.WeightUnitEnum; -import com.goshippo.sdk.models.operations.CreateShipmentResponse; -import java.lang.Exception; -import java.util.List; - -public class Application { - - public static void main(String[] args) throws Exception { - - Shippo sdk = Shippo.builder() - .apiKeyHeader("") - .shippoApiVersion("2018-02-08") - .build(); - - CreateShipmentResponse res = sdk.shipments().create() - .shippoApiVersion("2018-02-08") - .shipmentCreateRequest(ShipmentCreateRequest.builder() - .addressFrom(AddressFrom.of(AddressCreateRequest.builder() - .country("US") - .name("Shwan Ippotle") - .company("Shippo") - .street1("215 Clayton St.") - .street3("") - .streetNo("") - .city("San Francisco") - .state("CA") - .zip("94117") - .phone("+1 555 341 9393") - .email("shippotle@shippo.com") - .isResidential(true) - .metadata("Customer ID 123456") - .validate(true) - .build())) - .addressTo(AddressTo.of("d799c2679e644279b59fe661ac8fa489")) - .parcels(List.of( - Parcels.of(ParcelCreateFromTemplateRequest.builder() - .massUnit(WeightUnitEnum.LB) - .weight("1") - .template(ParcelTemplateEnumSet.of(ParcelTemplateFedExEnum.FED_EX_BOX25KG)) - .extra(ParcelExtra.builder() - .cod(Cod.builder() - .amount("5.5") - .currency("USD") - .paymentMethod(PaymentMethod.CASH) - .build()) - .insurance(ParcelInsurance.builder() - .amount("5.5") - .content("Laptop") - .currency("USD") - .provider(ParcelInsuranceProvider.UPS) - .build()) - .build()) - .metadata("Customer ID 123456") - .build()))) - .extra(ShipmentExtra.builder() - .accountsReceivableCustomerAccount(UPSReferenceFields.builder() - .prefix("ABC") - .value("value") - .refSort(1L) - .build()) - .appropriationNumber(UPSReferenceFields.builder() - .prefix("ABC") - .value("value") - .refSort(1L) - .build()) - .billOfLadingNumber(UPSReferenceFields.builder() - .prefix("ABC") - .value("value") - .refSort(1L) - .build()) - .cod(Cod.builder() - .amount("5.5") - .currency("USD") - .paymentMethod(PaymentMethod.CASH) - .build()) - .codNumber(UPSReferenceFields.builder() - .prefix("ABC") - .value("value") - .refSort(1L) - .build()) - .customerReference(CustomerReference.builder() - .refSort(1L) - .build()) - .dealerOrderNumber(UPSReferenceFields.builder() - .prefix("ABC") - .value("value") - .refSort(1L) - .build()) - .deptNumber(DepartmentNumber.builder() - .refSort(3L) - .build()) - .fdaProductCode(UPSReferenceFields.builder() - .prefix("ABC") - .value("value") - .refSort(1L) - .build()) - .insurance(Insurance.builder() - .amount("5.5") - .currency("USD") - .build()) - .invoiceNumber(InvoiceNumber.builder() - .refSort(2L) - .build()) - .manifestNumber(UPSReferenceFields.builder() - .prefix("ABC") - .value("value") - .refSort(1L) - .build()) - .modelNumber(UPSReferenceFields.builder() - .prefix("ABC") - .value("value") - .refSort(1L) - .build()) - .partNumber(UPSReferenceFields.builder() - .prefix("ABC") - .value("value") - .refSort(1L) - .build()) - .poNumber(PoNumber.builder() - .refSort(2L) - .build()) - .productionCode(UPSReferenceFields.builder() - .prefix("ABC") - .value("value") - .refSort(1L) - .build()) - .purchaseRequestNumber(UPSReferenceFields.builder() - .prefix("ABC") - .value("value") - .refSort(1L) - .build()) - .rmaNumber(RmaNumber.builder() - .refSort(1L) - .build()) - .salespersonNumber(UPSReferenceFields.builder() - .prefix("ABC") - .value("value") - .refSort(1L) - .build()) - .serialNumber(UPSReferenceFields.builder() - .prefix("ABC") - .value("value") - .refSort(1L) - .build()) - .storeNumber(UPSReferenceFields.builder() - .prefix("ABC") - .value("value") - .refSort(1L) - .build()) - .transactionReferenceNumber(UPSReferenceFields.builder() - .prefix("ABC") - .value("value") - .refSort(1L) - .build()) - .build()) - .metadata("Customer ID 123456") - .shipmentDate("2021-03-22T12:00:00Z") - .addressReturn(AddressReturn.of("d799c2679e644279b59fe661ac8fa488")) - .customsDeclaration(ShipmentCreateRequestCustomsDeclaration.of("adcfdddf8ec64b84ad22772bce3ea37a")) - .carrierAccounts(List.of( - "065a4a8c10d24a34ab932163a1b87f52", - "73f706f4bdb94b54a337563840ce52b0")) - .build()) - .call(); - - if (res.shipment().isPresent()) { - // handle response - } - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `shippoApiVersion` | *Optional\* | :heavy_minus_sign: | Optional string used to pick a non-default API version to use. See our API version guide. | 2018-02-08 | -| `shipmentCreateRequest` | [ShipmentCreateRequest](../../models/components/ShipmentCreateRequest.md) | :heavy_check_mark: | Shipment details and contact info. | | - -### Response - -**[CreateShipmentResponse](../../models/operations/CreateShipmentResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4XX, 5XX | \*/\* | - -## get - -Returns an existing shipment using an object ID - -### Example Usage - -```java -package hello.world; - -import com.goshippo.sdk.Shippo; -import com.goshippo.sdk.models.operations.GetShipmentResponse; -import java.lang.Exception; - -public class Application { - - public static void main(String[] args) throws Exception { - - Shippo sdk = Shippo.builder() - .apiKeyHeader("") - .shippoApiVersion("2018-02-08") - .build(); - - GetShipmentResponse res = sdk.shipments().get() - .shipmentId("") - .shippoApiVersion("2018-02-08") - .call(); - - if (res.shipment().isPresent()) { - // handle response - } - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `shipmentId` | *String* | :heavy_check_mark: | Object ID of the shipment to update | | -| `shippoApiVersion` | *Optional\* | :heavy_minus_sign: | Optional string used to pick a non-default API version to use. See our API version guide. | 2018-02-08 | - -### Response - -**[GetShipmentResponse](../../models/operations/GetShipmentResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/shippo/README.md b/docs/sdks/shippo/README.md deleted file mode 100644 index 91ba14ff..00000000 --- a/docs/sdks/shippo/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# Shippo SDK - -## Overview - -Shippo external API.: Use this API to integrate with the Shippo service \ No newline at end of file diff --git a/docs/sdks/shippoaccounts/README.md b/docs/sdks/shippoaccounts/README.md deleted file mode 100644 index a90043cd..00000000 --- a/docs/sdks/shippoaccounts/README.md +++ /dev/null @@ -1,236 +0,0 @@ -# ShippoAccounts -(*shippoAccounts()*) - -## Overview - -Shippo Accounts are used by Shippo Platform Accounts to create and manage Managed Shippo Accounts. -Managed Shippo Accounts are headless accounts that represent your customers. They are opaque to your end customers, meaning customers do not need to create their own Shippo login or have a billing relationship with Shippo. -They can be used by marketplaces, e-commerce platforms, and third-party logistics providers who want to offer, seamless, built-in shipping functionality to their customers. See our guide for more details. - - -### Available Operations - -* [list](#list) - List all Shippo Accounts -* [create](#create) - Create a Shippo Account -* [get](#get) - Retrieve a Shippo Account -* [update](#update) - Update a Shippo Account - -## list - -Returns a list of Shippo Managed Accounts objects. - -### Example Usage - -```java -package hello.world; - -import com.goshippo.sdk.Shippo; -import com.goshippo.sdk.models.operations.ListShippoAccountsResponse; -import java.lang.Exception; - -public class Application { - - public static void main(String[] args) throws Exception { - - Shippo sdk = Shippo.builder() - .apiKeyHeader("") - .shippoApiVersion("2018-02-08") - .build(); - - ListShippoAccountsResponse res = sdk.shippoAccounts().list() - .page(1L) - .results(25L) - .shippoApiVersion("2018-02-08") - .call(); - - if (res.shippoAccountPaginatedList().isPresent()) { - // handle response - } - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `page` | *Optional\* | :heavy_minus_sign: | The page number you want to select | | -| `results` | *Optional\* | :heavy_minus_sign: | The number of results to return per page (max 100) | | -| `shippoApiVersion` | *Optional\* | :heavy_minus_sign: | Optional string used to pick a non-default API version to use. See our API version guide. | 2018-02-08 | - -### Response - -**[ListShippoAccountsResponse](../../models/operations/ListShippoAccountsResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4XX, 5XX | \*/\* | - -## create - -Creates a new Shippo Managed Account. - -### Example Usage - -```java -package hello.world; - -import com.goshippo.sdk.Shippo; -import com.goshippo.sdk.models.components.ShippoAccountUpdateRequest; -import com.goshippo.sdk.models.operations.CreateShippoAccountResponse; -import java.lang.Exception; - -public class Application { - - public static void main(String[] args) throws Exception { - - Shippo sdk = Shippo.builder() - .apiKeyHeader("") - .shippoApiVersion("2018-02-08") - .build(); - - CreateShippoAccountResponse res = sdk.shippoAccounts().create() - .shippoApiVersion("2018-02-08") - .shippoAccountUpdateRequest(ShippoAccountUpdateRequest.builder() - .email("hippo@shippo.com") - .firstName("Shippo") - .lastName("Meister") - .companyName("Acme") - .build()) - .call(); - - if (res.shippoAccount().isPresent()) { - // handle response - } - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `shippoApiVersion` | *Optional\* | :heavy_minus_sign: | Optional string used to pick a non-default API version to use. See our API version guide. | 2018-02-08 | -| `shippoAccountUpdateRequest` | [ShippoAccountUpdateRequest](../../models/components/ShippoAccountUpdateRequest.md) | :heavy_check_mark: | N/A | | - -### Response - -**[CreateShippoAccountResponse](../../models/operations/CreateShippoAccountResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4XX, 5XX | \*/\* | - -## get - -Returns a Shippo Managed Account using an object ID. - -### Example Usage - -```java -package hello.world; - -import com.goshippo.sdk.Shippo; -import com.goshippo.sdk.models.operations.GetShippoAccountResponse; -import java.lang.Exception; - -public class Application { - - public static void main(String[] args) throws Exception { - - Shippo sdk = Shippo.builder() - .apiKeyHeader("") - .shippoApiVersion("2018-02-08") - .build(); - - GetShippoAccountResponse res = sdk.shippoAccounts().get() - .shippoAccountId("") - .shippoApiVersion("2018-02-08") - .call(); - - if (res.shippoAccount().isPresent()) { - // handle response - } - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `shippoAccountId` | *String* | :heavy_check_mark: | Object ID of the ShippoAccount | | -| `shippoApiVersion` | *Optional\* | :heavy_minus_sign: | Optional string used to pick a non-default API version to use. See our API version guide. | 2018-02-08 | - -### Response - -**[GetShippoAccountResponse](../../models/operations/GetShippoAccountResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4XX, 5XX | \*/\* | - -## update - -Updates a Shippo Managed Account using an object ID. - -### Example Usage - -```java -package hello.world; - -import com.goshippo.sdk.Shippo; -import com.goshippo.sdk.models.components.ShippoAccountUpdateRequest; -import com.goshippo.sdk.models.operations.UpdateShippoAccountResponse; -import java.lang.Exception; - -public class Application { - - public static void main(String[] args) throws Exception { - - Shippo sdk = Shippo.builder() - .apiKeyHeader("") - .shippoApiVersion("2018-02-08") - .build(); - - UpdateShippoAccountResponse res = sdk.shippoAccounts().update() - .shippoAccountId("") - .shippoApiVersion("2018-02-08") - .shippoAccountUpdateRequest(ShippoAccountUpdateRequest.builder() - .email("hippo@shippo.com") - .firstName("Shippo") - .lastName("Meister") - .companyName("Acme") - .build()) - .call(); - - if (res.shippoAccount().isPresent()) { - // handle response - } - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `shippoAccountId` | *String* | :heavy_check_mark: | Object ID of the ShippoAccount | | -| `shippoApiVersion` | *Optional\* | :heavy_minus_sign: | Optional string used to pick a non-default API version to use. See our API version guide. | 2018-02-08 | -| `shippoAccountUpdateRequest` | [Optional\](../../models/components/ShippoAccountUpdateRequest.md) | :heavy_minus_sign: | N/A | | - -### Response - -**[UpdateShippoAccountResponse](../../models/operations/UpdateShippoAccountResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/trackingstatus/README.md b/docs/sdks/trackingstatus/README.md deleted file mode 100644 index 7fec79aa..00000000 --- a/docs/sdks/trackingstatus/README.md +++ /dev/null @@ -1,130 +0,0 @@ -# TrackingStatus -(*trackingStatus()*) - -## Overview - -


-If you purchased your shipping label through Shippo, you can also get all the tracking details of your Shipment -from the Transaction object. -

-A tracking status of a package is an indication of current location of a package in the supply chain. For example, sorting, warehousing, or out for delivery. Use the tracking status object to track the location of your shipments. - -When using your Test token for tracking, you need to use Shippo's -predefined tokens for testing different tracking statuses. You can find more information in our -Tracking tutorial on how to do this, and what the -payloads look like. - - -### Available Operations - -* [create](#create) - Register a tracking webhook -* [get](#get) - Get a tracking status - -## create - -Registers a webhook that will send HTTP notifications to you when the status of your tracked package changes. For more details on creating a webhook, see our guides on Webhooks and Tracking. - -### Example Usage - -```java -package hello.world; - -import com.goshippo.sdk.Shippo; -import com.goshippo.sdk.models.components.TracksRequest; -import com.goshippo.sdk.models.operations.CreateTrackResponse; -import java.lang.Exception; - -public class Application { - - public static void main(String[] args) throws Exception { - - Shippo sdk = Shippo.builder() - .apiKeyHeader("") - .shippoApiVersion("2018-02-08") - .build(); - - CreateTrackResponse res = sdk.trackingStatus().create() - .shippoApiVersion("2018-02-08") - .tracksRequest(TracksRequest.builder() - .carrier("usps") - .trackingNumber("9205590164917312751089") - .metadata("Order 000123") - .build()) - .call(); - - if (res.track().isPresent()) { - // handle response - } - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `shippoApiVersion` | *Optional\* | :heavy_minus_sign: | Optional string used to pick a non-default API version to use. See our API version guide. | 2018-02-08 | -| `tracksRequest` | [TracksRequest](../../models/components/TracksRequest.md) | :heavy_check_mark: | N/A | | - -### Response - -**[CreateTrackResponse](../../models/operations/CreateTrackResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4XX, 5XX | \*/\* | - -## get - -Returns the tracking status of a shipment using a carrier name and a tracking number. - -### Example Usage - -```java -package hello.world; - -import com.goshippo.sdk.Shippo; -import com.goshippo.sdk.models.operations.GetTrackResponse; -import java.lang.Exception; - -public class Application { - - public static void main(String[] args) throws Exception { - - Shippo sdk = Shippo.builder() - .apiKeyHeader("") - .shippoApiVersion("2018-02-08") - .build(); - - GetTrackResponse res = sdk.trackingStatus().get() - .trackingNumber("") - .carrier("") - .shippoApiVersion("2018-02-08") - .call(); - - if (res.track().isPresent()) { - // handle response - } - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `trackingNumber` | *String* | :heavy_check_mark: | Tracking number | | -| `carrier` | *String* | :heavy_check_mark: | Name of the carrier | | -| `shippoApiVersion` | *Optional\* | :heavy_minus_sign: | Optional string used to pick a non-default API version to use. See our API version guide. | 2018-02-08 | - -### Response - -**[GetTrackResponse](../../models/operations/GetTrackResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/transactions/README.md b/docs/sdks/transactions/README.md deleted file mode 100644 index a349a951..00000000 --- a/docs/sdks/transactions/README.md +++ /dev/null @@ -1,181 +0,0 @@ -# Transactions -(*transactions()*) - -## Overview - -A transaction is the purchase of a shipping label from a shipping provider for a specific service. You can print purchased labels and used them to ship a parcel with a carrier, such as USPS or FedEx. - - -### Available Operations - -* [list](#list) - List all shipping labels -* [create](#create) - Create a shipping label -* [get](#get) - Retrieve a shipping label - -## list - -Returns a list of all transaction objects. - -### Example Usage - -```java -package hello.world; - -import com.goshippo.sdk.Shippo; -import com.goshippo.sdk.models.components.TrackingStatusEnum; -import com.goshippo.sdk.models.components.TransactionStatusEnum; -import com.goshippo.sdk.models.operations.ListTransactionsRequest; -import com.goshippo.sdk.models.operations.ListTransactionsResponse; -import java.lang.Exception; - -public class Application { - - public static void main(String[] args) throws Exception { - - Shippo sdk = Shippo.builder() - .apiKeyHeader("") - .shippoApiVersion("2018-02-08") - .build(); - - ListTransactionsRequest req = ListTransactionsRequest.builder() - .objectStatus(TransactionStatusEnum.SUCCESS) - .trackingStatus(TrackingStatusEnum.DELIVERED) - .build(); - - ListTransactionsResponse res = sdk.transactions().list() - .request(req) - .call(); - - if (res.transactionPaginatedList().isPresent()) { - // handle response - } - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | -| `request` | [ListTransactionsRequest](../../models/operations/ListTransactionsRequest.md) | :heavy_check_mark: | The request object to use for the request. | - -### Response - -**[ListTransactionsResponse](../../models/operations/ListTransactionsResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4XX, 5XX | \*/\* | - -## create - -Creates a new transaction object and purchases the shipping label using a rate object that has previously been created.
OR
Creates a new transaction object and purchases the shipping label instantly using shipment details, an existing carrier account, and an existing service level token. - -### Example Usage - -```java -package hello.world; - -import com.goshippo.sdk.Shippo; -import com.goshippo.sdk.models.components.LabelFileTypeEnum; -import com.goshippo.sdk.models.components.TransactionCreateRequest; -import com.goshippo.sdk.models.operations.CreateTransactionRequestBody; -import com.goshippo.sdk.models.operations.CreateTransactionResponse; -import java.lang.Exception; - -public class Application { - - public static void main(String[] args) throws Exception { - - Shippo sdk = Shippo.builder() - .apiKeyHeader("") - .shippoApiVersion("2018-02-08") - .build(); - - CreateTransactionResponse res = sdk.transactions().create() - .shippoApiVersion("2018-02-08") - .requestBody(CreateTransactionRequestBody.of(TransactionCreateRequest.builder() - .rate("ec9f0d3adc9441449c85d315f0997fd5") - .async(false) - .labelFileType(LabelFileTypeEnum.PDF4X6) - .metadata("Order ID #12345") - .order("adcfdddf8ec64b84ad22772bce3ea37a") - .build())) - .call(); - - if (res.transaction().isPresent()) { - // handle response - } - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `shippoApiVersion` | *Optional\* | :heavy_minus_sign: | Optional string used to pick a non-default API version to use. See our API version guide. | 2018-02-08 | -| `requestBody` | [CreateTransactionRequestBody](../../models/operations/CreateTransactionRequestBody.md) | :heavy_check_mark: | Examples. | | - -### Response - -**[CreateTransactionResponse](../../models/operations/CreateTransactionResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4XX, 5XX | \*/\* | - -## get - -Returns an existing transaction using an object ID. - -### Example Usage - -```java -package hello.world; - -import com.goshippo.sdk.Shippo; -import com.goshippo.sdk.models.operations.GetTransactionResponse; -import java.lang.Exception; - -public class Application { - - public static void main(String[] args) throws Exception { - - Shippo sdk = Shippo.builder() - .apiKeyHeader("") - .shippoApiVersion("2018-02-08") - .build(); - - GetTransactionResponse res = sdk.transactions().get() - .transactionId("") - .shippoApiVersion("2018-02-08") - .call(); - - if (res.transaction().isPresent()) { - // handle response - } - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `transactionId` | *String* | :heavy_check_mark: | Object ID of the transaction to update | | -| `shippoApiVersion` | *Optional\* | :heavy_minus_sign: | Optional string used to pick a non-default API version to use. See our API version guide. | 2018-02-08 | - -### Response - -**[GetTransactionResponse](../../models/operations/GetTransactionResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/userparceltemplates/README.md b/docs/sdks/userparceltemplates/README.md deleted file mode 100644 index b94426a0..00000000 --- a/docs/sdks/userparceltemplates/README.md +++ /dev/null @@ -1,297 +0,0 @@ -# UserParcelTemplates -(*userParcelTemplates()*) - -## Overview - -A user parcel template represents a package used for shipping that has preset dimensions and attributes defined -by you. They are useful for capturing attributes of parcel-types you frequently use for shipping, allowing -them to be defined once and then used for many shipments. These parcel templates can also be used for live rates. - -User parcel templates can also be created using a carrier parcel template, where the dimensions will be copied from -the carrier presets, but the weight can be configured by you. - - -### Available Operations - -* [list](#list) - List all user parcel templates -* [create](#create) - Create a new user parcel template -* [delete](#delete) - Delete a user parcel template -* [get](#get) - Retrieves a user parcel template -* [update](#update) - Update an existing user parcel template - -## list - -Returns a list all of all user parcel template objects. - -### Example Usage - -```java -package hello.world; - -import com.goshippo.sdk.Shippo; -import com.goshippo.sdk.models.operations.ListUserParcelTemplatesResponse; -import java.lang.Exception; - -public class Application { - - public static void main(String[] args) throws Exception { - - Shippo sdk = Shippo.builder() - .apiKeyHeader("") - .shippoApiVersion("2018-02-08") - .build(); - - ListUserParcelTemplatesResponse res = sdk.userParcelTemplates().list() - .shippoApiVersion("2018-02-08") - .call(); - - if (res.userParcelTemplateList().isPresent()) { - // handle response - } - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `shippoApiVersion` | *Optional\* | :heavy_minus_sign: | Optional string used to pick a non-default API version to use. See our API version guide. | 2018-02-08 | - -### Response - -**[ListUserParcelTemplatesResponse](../../models/operations/ListUserParcelTemplatesResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4XX, 5XX | \*/\* | - -## create - -Creates a new user parcel template.
You can choose to create a -parcel template using a preset carrier template as a starting point, or -you can create an entirely custom one. To use a preset carrier template, -pass in a unique template token from this list -plus the weight fields (**weight** and **weight_unit**). Otherwise, omit -the template field and pass the other fields, for the weight, length, height, -and depth, as well as their units." - -### Example Usage - -```java -package hello.world; - -import com.goshippo.sdk.Shippo; -import com.goshippo.sdk.models.components.UserParcelTemplateCreateRequest; -import com.goshippo.sdk.models.components.UserParcelTemplateWithCarrierTemplateCreateRequest; -import com.goshippo.sdk.models.components.WeightUnitEnum; -import com.goshippo.sdk.models.operations.CreateUserParcelTemplateResponse; -import java.lang.Exception; - -public class Application { - - public static void main(String[] args) throws Exception { - - Shippo sdk = Shippo.builder() - .apiKeyHeader("") - .shippoApiVersion("2018-02-08") - .build(); - - CreateUserParcelTemplateResponse res = sdk.userParcelTemplates().create() - .shippoApiVersion("2018-02-08") - .userParcelTemplateCreateRequest(UserParcelTemplateCreateRequest.of(UserParcelTemplateWithCarrierTemplateCreateRequest.builder() - .weight("12") - .weightUnit(WeightUnitEnum.LB) - .build())) - .call(); - - if (res.userParcelTemplate().isPresent()) { - // handle response - } - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `shippoApiVersion` | *Optional\* | :heavy_minus_sign: | Optional string used to pick a non-default API version to use. See our API version guide. | 2018-02-08 | -| `userParcelTemplateCreateRequest` | [UserParcelTemplateCreateRequest](../../models/components/UserParcelTemplateCreateRequest.md) | :heavy_check_mark: | N/A | | - -### Response - -**[CreateUserParcelTemplateResponse](../../models/operations/CreateUserParcelTemplateResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4XX, 5XX | \*/\* | - -## delete - -Deletes a user parcel template using an object ID. - -### Example Usage - -```java -package hello.world; - -import com.goshippo.sdk.Shippo; -import com.goshippo.sdk.models.operations.DeleteUserParcelTemplateResponse; -import java.lang.Exception; - -public class Application { - - public static void main(String[] args) throws Exception { - - Shippo sdk = Shippo.builder() - .apiKeyHeader("") - .shippoApiVersion("2018-02-08") - .build(); - - DeleteUserParcelTemplateResponse res = sdk.userParcelTemplates().delete() - .userParcelTemplateObjectId("") - .shippoApiVersion("2018-02-08") - .call(); - - // handle response - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `userParcelTemplateObjectId` | *String* | :heavy_check_mark: | Object ID of the user parcel template | | -| `shippoApiVersion` | *Optional\* | :heavy_minus_sign: | Optional string used to pick a non-default API version to use. See our API version guide. | 2018-02-08 | - -### Response - -**[DeleteUserParcelTemplateResponse](../../models/operations/DeleteUserParcelTemplateResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4XX, 5XX | \*/\* | - -## get - -Returns the parcel template information for a specific user parcel -template, identified by the object ID. - -### Example Usage - -```java -package hello.world; - -import com.goshippo.sdk.Shippo; -import com.goshippo.sdk.models.operations.GetUserParcelTemplateResponse; -import java.lang.Exception; - -public class Application { - - public static void main(String[] args) throws Exception { - - Shippo sdk = Shippo.builder() - .apiKeyHeader("") - .shippoApiVersion("2018-02-08") - .build(); - - GetUserParcelTemplateResponse res = sdk.userParcelTemplates().get() - .userParcelTemplateObjectId("") - .shippoApiVersion("2018-02-08") - .call(); - - if (res.userParcelTemplate().isPresent()) { - // handle response - } - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `userParcelTemplateObjectId` | *String* | :heavy_check_mark: | Object ID of the user parcel template | | -| `shippoApiVersion` | *Optional\* | :heavy_minus_sign: | Optional string used to pick a non-default API version to use. See our API version guide. | 2018-02-08 | - -### Response - -**[GetUserParcelTemplateResponse](../../models/operations/GetUserParcelTemplateResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4XX, 5XX | \*/\* | - -## update - -Updates an existing user parcel template. - -### Example Usage - -```java -package hello.world; - -import com.goshippo.sdk.Shippo; -import com.goshippo.sdk.models.components.DistanceUnitEnum; -import com.goshippo.sdk.models.components.UserParcelTemplateUpdateRequest; -import com.goshippo.sdk.models.components.WeightUnitEnum; -import com.goshippo.sdk.models.operations.UpdateUserParcelTemplateResponse; -import java.lang.Exception; - -public class Application { - - public static void main(String[] args) throws Exception { - - Shippo sdk = Shippo.builder() - .apiKeyHeader("") - .shippoApiVersion("2018-02-08") - .build(); - - UpdateUserParcelTemplateResponse res = sdk.userParcelTemplates().update() - .userParcelTemplateObjectId("") - .shippoApiVersion("2018-02-08") - .userParcelTemplateUpdateRequest(UserParcelTemplateUpdateRequest.builder() - .distanceUnit(DistanceUnitEnum.IN) - .height("6") - .length("10") - .name("My Custom Template") - .width("8") - .weight("12") - .weightUnit(WeightUnitEnum.LB) - .build()) - .call(); - - if (res.userParcelTemplate().isPresent()) { - // handle response - } - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `userParcelTemplateObjectId` | *String* | :heavy_check_mark: | Object ID of the user parcel template | | -| `shippoApiVersion` | *Optional\* | :heavy_minus_sign: | Optional string used to pick a non-default API version to use. See our API version guide. | 2018-02-08 | -| `userParcelTemplateUpdateRequest` | [Optional\](../../models/components/UserParcelTemplateUpdateRequest.md) | :heavy_minus_sign: | N/A | | - -### Response - -**[UpdateUserParcelTemplateResponse](../../models/operations/UpdateUserParcelTemplateResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/webhooks/README.md b/docs/sdks/webhooks/README.md deleted file mode 100644 index e2618cc4..00000000 --- a/docs/sdks/webhooks/README.md +++ /dev/null @@ -1,273 +0,0 @@ -# Webhooks -(*webhooks()*) - -## Overview - -Webhooks are a way for Shippo to notify your application when a specific event occurs. For example, when a label is purchased or when a shipment tracking status has changed. You can use webhooks to trigger actions in your application, such as sending an email or updating a database. - - -# Webhook Payload -The payload is the body of the POST request Shippo sends to the URL specified at the time of webhook registration. - - -### Available Operations - -* [createWebhook](#createwebhook) - Create a new webhook -* [listWebhooks](#listwebhooks) - List all webhooks -* [getWebhook](#getwebhook) - Retrieve a specific webhook -* [updateWebhook](#updatewebhook) - Update an existing webhook -* [deleteWebhook](#deletewebhook) - Delete a specific webhook - -## createWebhook - -Creates a new webhook to send notifications to a URL when a specific event occurs. - -### Example Usage - -```java -package hello.world; - -import com.goshippo.sdk.Shippo; -import com.goshippo.sdk.models.components.WebhookEventTypeEnum; -import com.goshippo.sdk.models.components.WebhookUpdateRequest; -import com.goshippo.sdk.models.operations.CreateWebhookResponse; -import java.lang.Exception; - -public class Application { - - public static void main(String[] args) throws Exception { - - Shippo sdk = Shippo.builder() - .apiKeyHeader("") - .shippoApiVersion("2018-02-08") - .build(); - - WebhookUpdateRequest req = WebhookUpdateRequest.builder() - .event(WebhookEventTypeEnum.BATCH_CREATED) - .url("https://example.com/shippo-webhook") - .active(true) - .isTest(false) - .build(); - - CreateWebhookResponse res = sdk.webhooks().createWebhook() - .request(req) - .call(); - - if (res.webhook().isPresent()) { - // handle response - } - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | -| `request` | [WebhookUpdateRequest](../../models/shared/WebhookUpdateRequest.md) | :heavy_check_mark: | The request object to use for the request. | - -### Response - -**[CreateWebhookResponse](../../models/operations/CreateWebhookResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4XX, 5XX | \*/\* | - -## listWebhooks - -Returns a list of all webhooks you have created. - -### Example Usage - -```java -package hello.world; - -import com.goshippo.sdk.Shippo; -import com.goshippo.sdk.models.operations.ListWebhooksResponse; -import java.lang.Exception; - -public class Application { - - public static void main(String[] args) throws Exception { - - Shippo sdk = Shippo.builder() - .apiKeyHeader("") - .shippoApiVersion("2018-02-08") - .build(); - - ListWebhooksResponse res = sdk.webhooks().listWebhooks() - .call(); - - if (res.webhookPaginatedList().isPresent()) { - // handle response - } - } -} -``` - -### Response - -**[ListWebhooksResponse](../../models/operations/ListWebhooksResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4XX, 5XX | \*/\* | - -## getWebhook - -Returns the details of a specific webhook using the webhook object ID. - -### Example Usage - -```java -package hello.world; - -import com.goshippo.sdk.Shippo; -import com.goshippo.sdk.models.operations.GetWebhookResponse; -import java.lang.Exception; - -public class Application { - - public static void main(String[] args) throws Exception { - - Shippo sdk = Shippo.builder() - .apiKeyHeader("") - .shippoApiVersion("2018-02-08") - .build(); - - GetWebhookResponse res = sdk.webhooks().getWebhook() - .webhookId("") - .call(); - - if (res.webhook().isPresent()) { - // handle response - } - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | -| `webhookId` | *String* | :heavy_check_mark: | Object ID of the webhook to retrieve | - -### Response - -**[GetWebhookResponse](../../models/operations/GetWebhookResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4XX, 5XX | \*/\* | - -## updateWebhook - -Updates an existing webhook using the webhook object ID. - -### Example Usage - -```java -package hello.world; - -import com.goshippo.sdk.Shippo; -import com.goshippo.sdk.models.components.WebhookEventTypeEnum; -import com.goshippo.sdk.models.components.WebhookUpdateRequest; -import com.goshippo.sdk.models.operations.UpdateWebhookResponse; -import java.lang.Exception; - -public class Application { - - public static void main(String[] args) throws Exception { - - Shippo sdk = Shippo.builder() - .apiKeyHeader("") - .shippoApiVersion("2018-02-08") - .build(); - - UpdateWebhookResponse res = sdk.webhooks().updateWebhook() - .webhookId("") - .webhookUpdateRequest(WebhookUpdateRequest.builder() - .event(WebhookEventTypeEnum.BATCH_CREATED) - .url("https://example.com/shippo-webhook") - .active(true) - .isTest(false) - .build()) - .call(); - - if (res.webhook().isPresent()) { - // handle response - } - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | -| `webhookId` | *String* | :heavy_check_mark: | Object ID of the webhook to retrieve | -| `webhookUpdateRequest` | [WebhookUpdateRequest](../../models/components/WebhookUpdateRequest.md) | :heavy_check_mark: | N/A | - -### Response - -**[UpdateWebhookResponse](../../models/operations/UpdateWebhookResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4XX, 5XX | \*/\* | - -## deleteWebhook - -Deletes a specific webhook using the webhook object ID. - -### Example Usage - -```java -package hello.world; - -import com.goshippo.sdk.Shippo; -import com.goshippo.sdk.models.operations.DeleteWebhookResponse; -import java.lang.Exception; - -public class Application { - - public static void main(String[] args) throws Exception { - - Shippo sdk = Shippo.builder() - .apiKeyHeader("") - .shippoApiVersion("2018-02-08") - .build(); - - DeleteWebhookResponse res = sdk.webhooks().deleteWebhook() - .webhookId("") - .call(); - - // handle response - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ---------------------------------- | ---------------------------------- | ---------------------------------- | ---------------------------------- | -| `webhookId` | *String* | :heavy_check_mark: | Object ID of the webhook to delete | - -### Response - -**[DeleteWebhookResponse](../../models/operations/DeleteWebhookResponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/src/main/java/com/goshippo/sdk/Batches.java b/src/main/java/com/goshippo/sdk/Batches.java index c16ea826..cd8f43f9 100644 --- a/src/main/java/com/goshippo/sdk/Batches.java +++ b/src/main/java/com/goshippo/sdk/Batches.java @@ -35,6 +35,7 @@ import com.goshippo.sdk.utils.Utils; import java.io.InputStream; import java.lang.Exception; +import java.lang.Long; import java.lang.Object; import java.lang.String; import java.net.http.HttpRequest; @@ -243,7 +244,7 @@ public GetBatchRequestBuilder get() { */ public GetBatchResponse get( String batchId) throws Exception { - return get(batchId, Optional.empty()); + return get(batchId, Optional.empty(), Optional.empty(), Optional.empty()); } /** @@ -253,17 +254,23 @@ public GetBatchResponse get( * status, for example, by passing a query param like `?object_results=creation_failed`. <br> * For more details on filtering results, see our guide on <a href="https://docs.goshippo.com/docs/api_concepts/filtering/" target="blank"> filtering</a>. * @param batchId Object ID of the batch + * @param page The page number you want to select + * @param results The number of results to return per page (max 100, default 5) * @param shippoApiVersion Optional string used to pick a non-default API version to use. See our API version guide. * @return The response from the API call * @throws Exception if the API call fails */ public GetBatchResponse get( String batchId, + Optional page, + Optional results, Optional shippoApiVersion) throws Exception { GetBatchRequest request = GetBatchRequest .builder() .batchId(batchId) + .page(page) + .results(results) .shippoApiVersion(shippoApiVersion) .build(); @@ -278,6 +285,11 @@ public GetBatchResponse get( _req.addHeader("Accept", "application/json") .addHeader("user-agent", SDKConfiguration.USER_AGENT); + + _req.addQueryParams(Utils.getQueryParams( + GetBatchRequest.class, + request, + this.sdkConfiguration.globals)); _req.addHeaders(Utils.getHeadersFromMetadata(request, this.sdkConfiguration.globals)); Utils.configureSecurity(_req, diff --git a/src/main/java/com/goshippo/sdk/SDKConfiguration.java b/src/main/java/com/goshippo/sdk/SDKConfiguration.java index bf017f15..44754904 100644 --- a/src/main/java/com/goshippo/sdk/SDKConfiguration.java +++ b/src/main/java/com/goshippo/sdk/SDKConfiguration.java @@ -27,7 +27,7 @@ public Optional securitySource() { public int serverIdx = 0; private static final String LANGUAGE = "java"; public static final String OPENAPI_DOC_VERSION = "2018-02-08"; - public static final String SDK_VERSION = "1.0.0-beta.1"; + public static final String SDK_VERSION = "1.0.0-beta.2"; public static final String GEN_VERSION = "2.461.4"; private static final String BASE_PACKAGE = "com.goshippo.sdk"; public static final String USER_AGENT = diff --git a/src/main/java/com/goshippo/sdk/models/operations/GetBatchRequest.java b/src/main/java/com/goshippo/sdk/models/operations/GetBatchRequest.java index beca99a1..87e17e2c 100644 --- a/src/main/java/com/goshippo/sdk/models/operations/GetBatchRequest.java +++ b/src/main/java/com/goshippo/sdk/models/operations/GetBatchRequest.java @@ -7,8 +7,11 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.type.TypeReference; +import com.goshippo.sdk.utils.LazySingletonValue; import com.goshippo.sdk.utils.SpeakeasyMetadata; import com.goshippo.sdk.utils.Utils; +import java.lang.Long; import java.lang.Override; import java.lang.String; import java.util.Objects; @@ -23,6 +26,18 @@ public class GetBatchRequest { @SpeakeasyMetadata("pathParam:style=simple,explode=false,name=BatchId") private String batchId; + /** + * The page number you want to select + */ + @SpeakeasyMetadata("queryParam:style=form,explode=true,name=page") + private Optional page; + + /** + * The number of results to return per page (max 100, default 5) + */ + @SpeakeasyMetadata("queryParam:style=form,explode=true,name=results") + private Optional results; + /** * Optional string used to pick a non-default API version to use. See our <a href="https://docs.goshippo.com/docs/api_concepts/apiversioning/">API version</a> guide. */ @@ -32,16 +47,22 @@ public class GetBatchRequest { @JsonCreator public GetBatchRequest( String batchId, + Optional page, + Optional results, Optional shippoApiVersion) { Utils.checkNotNull(batchId, "batchId"); + Utils.checkNotNull(page, "page"); + Utils.checkNotNull(results, "results"); Utils.checkNotNull(shippoApiVersion, "shippoApiVersion"); this.batchId = batchId; + this.page = page; + this.results = results; this.shippoApiVersion = shippoApiVersion; } public GetBatchRequest( String batchId) { - this(batchId, Optional.empty()); + this(batchId, Optional.empty(), Optional.empty(), Optional.empty()); } /** @@ -52,6 +73,22 @@ public String batchId() { return batchId; } + /** + * The page number you want to select + */ + @JsonIgnore + public Optional page() { + return page; + } + + /** + * The number of results to return per page (max 100, default 5) + */ + @JsonIgnore + public Optional results() { + return results; + } + /** * Optional string used to pick a non-default API version to use. See our <a href="https://docs.goshippo.com/docs/api_concepts/apiversioning/">API version</a> guide. */ @@ -73,6 +110,42 @@ public GetBatchRequest withBatchId(String batchId) { return this; } + /** + * The page number you want to select + */ + public GetBatchRequest withPage(long page) { + Utils.checkNotNull(page, "page"); + this.page = Optional.ofNullable(page); + return this; + } + + /** + * The page number you want to select + */ + public GetBatchRequest withPage(Optional page) { + Utils.checkNotNull(page, "page"); + this.page = page; + return this; + } + + /** + * The number of results to return per page (max 100, default 5) + */ + public GetBatchRequest withResults(long results) { + Utils.checkNotNull(results, "results"); + this.results = Optional.ofNullable(results); + return this; + } + + /** + * The number of results to return per page (max 100, default 5) + */ + public GetBatchRequest withResults(Optional results) { + Utils.checkNotNull(results, "results"); + this.results = results; + return this; + } + /** * Optional string used to pick a non-default API version to use. See our <a href="https://docs.goshippo.com/docs/api_concepts/apiversioning/">API version</a> guide. */ @@ -102,6 +175,8 @@ public boolean equals(java.lang.Object o) { GetBatchRequest other = (GetBatchRequest) o; return Objects.deepEquals(this.batchId, other.batchId) && + Objects.deepEquals(this.page, other.page) && + Objects.deepEquals(this.results, other.results) && Objects.deepEquals(this.shippoApiVersion, other.shippoApiVersion); } @@ -109,6 +184,8 @@ public boolean equals(java.lang.Object o) { public int hashCode() { return Objects.hash( batchId, + page, + results, shippoApiVersion); } @@ -116,6 +193,8 @@ public int hashCode() { public String toString() { return Utils.toString(GetBatchRequest.class, "batchId", batchId, + "page", page, + "results", results, "shippoApiVersion", shippoApiVersion); } @@ -123,6 +202,10 @@ public final static class Builder { private String batchId; + private Optional page; + + private Optional results; + private Optional shippoApiVersion = Optional.empty(); private Builder() { @@ -138,6 +221,42 @@ public Builder batchId(String batchId) { return this; } + /** + * The page number you want to select + */ + public Builder page(long page) { + Utils.checkNotNull(page, "page"); + this.page = Optional.ofNullable(page); + return this; + } + + /** + * The page number you want to select + */ + public Builder page(Optional page) { + Utils.checkNotNull(page, "page"); + this.page = page; + return this; + } + + /** + * The number of results to return per page (max 100, default 5) + */ + public Builder results(long results) { + Utils.checkNotNull(results, "results"); + this.results = Optional.ofNullable(results); + return this; + } + + /** + * The number of results to return per page (max 100, default 5) + */ + public Builder results(Optional results) { + Utils.checkNotNull(results, "results"); + this.results = results; + return this; + } + /** * Optional string used to pick a non-default API version to use. See our <a href="https://docs.goshippo.com/docs/api_concepts/apiversioning/">API version</a> guide. */ @@ -157,10 +276,29 @@ public Builder shippoApiVersion(Optional shippoApiVersion) { } public GetBatchRequest build() { - return new GetBatchRequest( + if (page == null) { + page = _SINGLETON_VALUE_Page.value(); + } + if (results == null) { + results = _SINGLETON_VALUE_Results.value(); + } return new GetBatchRequest( batchId, + page, + results, shippoApiVersion); } + + private static final LazySingletonValue> _SINGLETON_VALUE_Page = + new LazySingletonValue<>( + "page", + "1", + new TypeReference>() {}); + + private static final LazySingletonValue> _SINGLETON_VALUE_Results = + new LazySingletonValue<>( + "results", + "5", + new TypeReference>() {}); } } diff --git a/src/main/java/com/goshippo/sdk/models/operations/GetBatchRequestBuilder.java b/src/main/java/com/goshippo/sdk/models/operations/GetBatchRequestBuilder.java index 026e3c0e..9dbb9cf1 100644 --- a/src/main/java/com/goshippo/sdk/models/operations/GetBatchRequestBuilder.java +++ b/src/main/java/com/goshippo/sdk/models/operations/GetBatchRequestBuilder.java @@ -4,13 +4,24 @@ package com.goshippo.sdk.models.operations; +import com.fasterxml.jackson.core.type.TypeReference; +import com.goshippo.sdk.utils.LazySingletonValue; import com.goshippo.sdk.utils.Utils; +import java.lang.Long; import java.lang.String; import java.util.Optional; public class GetBatchRequestBuilder { private String batchId; + private Optional page = Utils.readDefaultOrConstValue( + "page", + "1", + new TypeReference>() {}); + private Optional results = Utils.readDefaultOrConstValue( + "results", + "5", + new TypeReference>() {}); private Optional shippoApiVersion = Optional.empty(); private final SDKMethodInterfaces.MethodCallGetBatch sdk; @@ -24,6 +35,30 @@ public GetBatchRequestBuilder batchId(String batchId) { return this; } + public GetBatchRequestBuilder page(long page) { + Utils.checkNotNull(page, "page"); + this.page = Optional.of(page); + return this; + } + + public GetBatchRequestBuilder page(Optional page) { + Utils.checkNotNull(page, "page"); + this.page = page; + return this; + } + + public GetBatchRequestBuilder results(long results) { + Utils.checkNotNull(results, "results"); + this.results = Optional.of(results); + return this; + } + + public GetBatchRequestBuilder results(Optional results) { + Utils.checkNotNull(results, "results"); + this.results = results; + return this; + } + public GetBatchRequestBuilder shippoApiVersion(String shippoApiVersion) { Utils.checkNotNull(shippoApiVersion, "shippoApiVersion"); this.shippoApiVersion = Optional.of(shippoApiVersion); @@ -37,9 +72,28 @@ public GetBatchRequestBuilder shippoApiVersion(Optional shippoApiVersion } public GetBatchResponse call() throws Exception { - + if (page == null) { + page = _SINGLETON_VALUE_Page.value(); + } + if (results == null) { + results = _SINGLETON_VALUE_Results.value(); + } return sdk.get( batchId, + page, + results, shippoApiVersion); } + + private static final LazySingletonValue> _SINGLETON_VALUE_Page = + new LazySingletonValue<>( + "page", + "1", + new TypeReference>() {}); + + private static final LazySingletonValue> _SINGLETON_VALUE_Results = + new LazySingletonValue<>( + "results", + "5", + new TypeReference>() {}); } diff --git a/src/main/java/com/goshippo/sdk/models/operations/SDKMethodInterfaces.java b/src/main/java/com/goshippo/sdk/models/operations/SDKMethodInterfaces.java index c307769d..b19836df 100644 --- a/src/main/java/com/goshippo/sdk/models/operations/SDKMethodInterfaces.java +++ b/src/main/java/com/goshippo/sdk/models/operations/SDKMethodInterfaces.java @@ -73,6 +73,8 @@ CreateBatchResponse create( public interface MethodCallGetBatch { GetBatchResponse get( String batchId, + Optional page, + Optional results, Optional shippoApiVersion) throws Exception; } diff --git a/src/test/java/com/goshippo/sdk/BatchesTests.java b/src/test/java/com/goshippo/sdk/BatchesTests.java new file mode 100644 index 00000000..184bf243 --- /dev/null +++ b/src/test/java/com/goshippo/sdk/BatchesTests.java @@ -0,0 +1,60 @@ +package com.goshippo.sdk; + +import com.goshippo.sdk.models.components.Batch; +import com.goshippo.sdk.models.operations.CreateBatchResponse; +import com.goshippo.sdk.models.operations.GetBatchResponse; +import org.junit.jupiter.api.Order; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertInstanceOf; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +public class BatchesTests extends SdkProvider { + + private final Generator generator = new Generator(); + private static String BATCH_OBJECT_ID; + + @Test + @Order(1) + public void shouldCreateBatch() throws Exception { + + final var request = generator.buildBatchCreateRequest( + getDefaultCarrierAccountObjectId()); + + final var response = getSdk().batches().create() + .shippoApiVersion("2018-02-08") + .batchCreateRequest(request) + .call(); + + assertNotNull(response); + assertInstanceOf(CreateBatchResponse.class, response); + + final var batch = response.batch().get(); + assertNotNull(batch); + assertInstanceOf(Batch.class, batch); + + assertNotNull(batch.objectId()); + BATCH_OBJECT_ID = batch.objectId(); + } + + @Test + @Order(2) + public void shouldListAllBatches() throws Exception { + final var response = getSdk().batches().get() + .batchId(BATCH_OBJECT_ID) + .page(1L) + .results(5L) + .call(); + + assertNotNull(response); + assertInstanceOf(GetBatchResponse.class, response); + + final var batch = response.batch().get(); + assertNotNull(batch); + assertInstanceOf(Batch.class, batch); + + assertNotNull(batch.objectId()); + assertNotNull(batch.objectOwner()); + assertNotNull(batch.batchShipments()); + } +} diff --git a/src/test/java/com/goshippo/sdk/CarrierAccountsTests.java b/src/test/java/com/goshippo/sdk/CarrierAccountsTests.java new file mode 100644 index 00000000..a91031a9 --- /dev/null +++ b/src/test/java/com/goshippo/sdk/CarrierAccountsTests.java @@ -0,0 +1,28 @@ +package com.goshippo.sdk; + +import com.goshippo.sdk.models.components.CarrierAccountPaginatedList; +import com.goshippo.sdk.models.operations.ListCarrierAccountsRequest; +import com.goshippo.sdk.models.operations.ListCarrierAccountsResponse; +import org.junit.jupiter.api.Test; + +import static com.goshippo.sdk.SdkProvider.getSdk; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +public class CarrierAccountsTests { + + @Test + public void shouldGetAllCarrierAccounts() throws Exception { + final var request = ListCarrierAccountsRequest.builder() + .build(); + + final var response = getSdk().carrierAccounts().list() + .request(request) + .call(); + + assertInstanceOf(ListCarrierAccountsResponse.class, response); + assertNotNull(response); + assertInstanceOf(CarrierAccountPaginatedList.class, response.carrierAccountPaginatedList().get()); + assertNotNull(response.carrierAccountPaginatedList().get()); + } +} diff --git a/src/test/java/com/goshippo/sdk/Generator.java b/src/test/java/com/goshippo/sdk/Generator.java new file mode 100644 index 00000000..67c28451 --- /dev/null +++ b/src/test/java/com/goshippo/sdk/Generator.java @@ -0,0 +1,133 @@ +package com.goshippo.sdk; + +import com.goshippo.sdk.models.components.AddressCreateRequest; +import com.goshippo.sdk.models.components.AddressFrom; +import com.goshippo.sdk.models.components.AddressTo; +import com.goshippo.sdk.models.components.BatchCreateRequest; +import com.goshippo.sdk.models.components.BatchShipmentCreateRequest; +import com.goshippo.sdk.models.components.DistanceUnitEnum; +import com.goshippo.sdk.models.components.ParcelCreateRequest; +import com.goshippo.sdk.models.components.Parcels; +import com.goshippo.sdk.models.components.ShipmentCreateRequest; +import com.goshippo.sdk.models.components.WeightUnitEnum; + +import java.util.List; + +// TODO should find a better way for us to generate test data +// Ideally language agnostic and could be used by all SDKs +public class Generator { + public AddressFrom buildAddressFrom() { + return AddressFrom.of(buildAddressCreateRequests().get(0)); + } + + public AddressTo buildAddressTo() { + return AddressTo.of(buildAddressCreateRequests().get(1)); + } + + public List buildParcels() { + return List.of(Parcels.of(buildParcelCreateRequest().get(0))); + } + + public List buildParcelCreateRequest() { + return List.of(ParcelCreateRequest.builder() + .distanceUnit(DistanceUnitEnum.IN) + .height("1") + .length("1") + .massUnit(WeightUnitEnum.LB) + .weight("1") + .width("1") + .build(), + ParcelCreateRequest.builder() + .weight("5") + .length("10") + .width("5") + .height("4") + .distanceUnit(DistanceUnitEnum.IN) + .massUnit(WeightUnitEnum.LB) + .build() + ); + } + + public ShipmentCreateRequest buildShipmentCreateRequest() { + return ShipmentCreateRequest.builder() + .addressFrom(buildAddressFrom()) + .addressTo(buildAddressTo()) + .parcels(buildParcels()) + .build(); + } + + public BatchCreateRequest buildBatchCreateRequest(String carrierAccountObjectId) { + return BatchCreateRequest.builder() + .defaultCarrierAccount(carrierAccountObjectId) + .defaultServicelevelToken("usps_priority") + .batchShipments(List.of( + BatchShipmentCreateRequest.builder() + .shipment(buildShipmentCreateRequest()) + .carrierAccount(carrierAccountObjectId) + .build())) + .build(); + } + + public List buildAddressCreateRequests() { + return List.of( + AddressCreateRequest.builder() + .name("Rachael") + .street1("1092 Indian Summer Ct") + .city("San Jose") + .state("CA") + .zip("94117") + .country("US") + .phone("4159876543") + .email("rachael@alltheyarnz.com") + .build(), + AddressCreateRequest.builder() + .name("Mr Hippo") + .street1("965 Mission St #572") + .city("San Francisco") + .state("CA") + .zip("94103") + .country("US") + .phone("4151234567") + .email("mrhippo@shippo.com") + .build(), + AddressCreateRequest.builder() + .country("US") + .name("Shwan Ippotle") + .company("Shippo") + .street1("215 Clayton St.") + .street3("") + .streetNo("") + .city("San Francisco") + .state("CA") + .zip("94117") + .phone("+1 555 341 9393") + .email("shippotle@shippo.com") + .isResidential(true) + .metadata("Customer ID 123456") + .validate(true) + .build(), + AddressCreateRequest.builder() + .name("Sarah") + .company("We Sell Guitars") + .street1("215 Clayton St.") + .city("San Francisco") + .state("CA") + .zip("94117") + .country("US") + .phone("+1 555 341 9393") + .email("sarah@wesellguitars.net") + .isResidential(false) + .metadata("We Sell Guitars HQ") + .build(), + AddressCreateRequest.builder() + .name("Tom Marks") + .street1("159 Broadhurst Gardens") + .city("London") + .zip("NW6 3AU") + .country("GB") + .phone("4159876543") + .email("tommarks@gmmail.com") + .build() + ); + } +} diff --git a/src/test/java/com/goshippo/sdk/SdkProvider.java b/src/test/java/com/goshippo/sdk/SdkProvider.java index 2ecda195..2fe12567 100644 --- a/src/test/java/com/goshippo/sdk/SdkProvider.java +++ b/src/test/java/com/goshippo/sdk/SdkProvider.java @@ -24,6 +24,10 @@ public CarrierAccountWithExtraInfo getCarrierAccount(CarriersEnum carrier) throw return getCarrierAccounts(carrier).get(0); } + public String getDefaultCarrierAccountObjectId() throws Exception { + return getCarrierAccount(CarriersEnum.USPS).objectId().get(); + } + public List getCarrierAccounts(CarriersEnum carrier) throws Exception { final var request = ListCarrierAccountsRequest.builder() .carrier(carrier)