GetPrintData - webapix/mygls-sdk GitHub Wiki

Validates parcel data for labels, adds valid parcel data to MyGLS's database, generates parcel numbers and returns data for custom generating labels.

use GuzzleHttp\Client as HttpClient;
use Webapix\GLS\Client;
use Webapix\Requests\GetPrintData;

$account = new DefaultAccount();

$client = new Client(new HttpClient);

$request = new GetPrintData();
$request->addParcelId(256234);

/** @var \Webapix\GLS\Responses\GetPrintData $response */
$response = $client->on($account)->request($request);

if ($response->successfull()) {

    // get the parcels information: ParcelId, ParcelNumber ...
    $response->printLabelsInfo();

}

Alternatively, you can add a Parcel object instead of parcel id:

$request = new GetPrintData();
$request->addParcel(new Webapix\GLS\Models\Parcel);