Skip to content

OddPrints/prodigi-java-sdk

Repository files navigation

Prodigi-Java-SDK

A java library for communicating with the Prodigi API.

v4.0 of the API is supported. If you want an older version, see the Pwinty Java SDK ;)

Releases

  • v4.0 - Initial release

Usage

Create and Order object using a builder pattern and submit it:

// Choose Environment.LIVE for real orders
Prodigi prodigi = new Prodigi(Prodigi.Environment.SANDBOX, "YOUR-API-KEY");

// Create Recipient
Recipient recipient = new Recipient("Bob", new Address("line1", "line2", "90210", CountryCode.GB, "Bristol"));

// Create Order
Order order = new Order.Builder(Order.ShippingMethod.Standard, recipient)
        .addImage("https://www.oddprints.com/images/header-dogcat.jpg", "GLOBAL-PHO-4x6", 1)
        .build();

// Submit to API
OrderResponse response = prodigi.createOrder(order);

Download

See jitpack

Basically, add the jitpack repository:

repositories {
    ...
    maven { url 'https://jitpack.io' }
}

and the dependency using the short git commit reference as the version:

dependencies {
    implementation 'com.github.OddPrints:prodigi-java-sdk:f3483f2'
}

Contribute/Extend

Everything is built using standard gradle.

Running the tests

This library has a comprehensive test suite which is helpful as the Prodigi API evolves. To run the tests yourself, just set en environment variable for your api key:

export PRODIGI_API_KEY_SANDBOX="YOUR_API_KEY"
./gradlew test