/electio-client

A PHP client for the Electio delivery management system

Primary LanguagePHPMIT LicenseMIT

A PHP client for the Electio delivery management system

Requirements

PHP 5.4.0 and later

Installation & Usage

Composer

To install the bindings via Composer, add the following to composer.json:

{
  "repositories": [
    {
      "type": "git",
      "url": "https://github.com/chrishemmings/electio-client.git"
    }
  ],
  "require": {
    "chrishemmings/electio-client": "*@dev"
  }
}

Then run composer install

Manual Installation

Download the files and include autoload.php:

    require_once('/path/to//autoload.php');

Tests

To run the unit tests:

composer install
./vendor/bin/phpunit lib/Tests

Getting Started

Please follow the installation procedure and then run the following:

<?php
require_once(__DIR__ . '/vendor/autoload.php');

$apiConfiguration = new ChrisHemmings\ElectioClient\Configuration();
$apiConfiguration->addDefaultHeader('Ocp-Apim-Subscription-Key', 'ocpApimSubscriptionKey_example');
$apiClient = new ChrisHemmings\ElectioClient\ApiClient($apiConfiguration);

$api_instance = new ChrisHemmings\ElectioClient\Api\ConsignmentsApi($apiClient);

try {
    $consignmentCount = $api_instance->getACountOfConsignments();
    echo "Current consignment count: " . $consignmentCount . "\n";
} catch (Exception $e) {
    echo 'Exception when calling AccountsApi->createAccount: ', $e->getMessage(), PHP_EOL;
}

Documentation for API Endpoints

All URIs are relative to https://api.electioapp.com

Class Method HTTP request Description
AccountsApi createAccount POST /Accounts/
AccountsApi generateNewPrimaryAPIKey PUT /Accounts/apikeygenerate/primary/{accountReference}
AccountsApi generateNewSecondaryAPIKey PUT /Accounts/apikeygenerate/secondary/{accountReference}
AccountsApi getAccountByEmailAddress GET /Accounts/{emailAddress}
AccountsApi getAccountByReference GET /Accounts/{accountReference}
AccountsApi getCustomersForAccount GET /Accounts/{accountReference}/customers
AccountsApi inviteAccount POST /Accounts/Invite
AccountsApi updateAccount PUT /Accounts/
AllocationApi allocateConsignmentsWithASpecificCarrierService PUT /Allocation/allocateWithCarrierService
AllocationApi allocateUsingASpecificQuote PUT /Allocation/{consignmentReference}/allocateWithQuote/{quoteReference}
AllocationApi allocateUsingDefaultRules PUT /Allocation/allocate
AllocationApi allocateWithCarrierServiceGroup PUT /Allocation/allocatewithservicegroup
AllocationApi allocateWithCheapestQuote PUT /Allocation/{consignmentReference}/allocateWithCheapestQuote
CarrierServicesApi getAvailableCarrierServices GET /carrierservices/carrierservices
CarrierServicesApi getAvailableMPDCarrierServices GET /carrierservices/
CarriersApi getCarrierServices GET /Carriers/
CarriersApi getCarriers GET /Carriers/getcarriers
CollectionCalendarApi getCollectionCalender GET /CollectionCalendar/{shippingLocation}/{carrierReference}
ConsignmentCustomersApi getManifestFile GET /ConsignmentCustomers/manifest/{reference}
ConsignmentCustomersApi getManifests GET /ConsignmentCustomers/manifests
ConsignmentsApi addPackageToConsignment POST /Consignments/{consignmentReference}/addpackage
ConsignmentsApi addPackagesToAConsignment POST /Consignments/{consignmentReference}/addpackages/{numberOfPackages}
ConsignmentsApi cancelAConsignment PUT /Consignments/{consignmentReference}/cancel
ConsignmentsApi createANewConsignment POST /Consignments/
ConsignmentsApi deAllocateTheSpecifiedConsignment PUT /Consignments/{consignmentReference}/deallocate
ConsignmentsApi getACountOfConsignments GET /Consignments/count
ConsignmentsApi getASummaryByCarrierInTheDatePeriod GET /Consignments/summary/courier
ConsignmentsApi getASummaryOfConsignmentsInDatePeriod GET /Consignments/summary
ConsignmentsApi getASummaryOfLatePackagesInTheDatePeriod GET /Consignments/summary/latepackages
ConsignmentsApi getCustomerManifestByReference GET /Consignments/customer/manifest/{manifestReference}
ConsignmentsApi getCustomsDocuments GET /Consignments/docs/{consignmentReference}
ConsignmentsApi getManifests GET /Consignments/customer/manifests
ConsignmentsApi getMultipleConsignmentDetails GET /Consignments/{take}/{skip}
ConsignmentsApi getTheSpecifiedConsignmentDetails GET /Consignments/{consignmentReference}
ConsignmentsApi getTheSpecifiedConsignmentDetailsByClientReference GET /Consignments/clientReference/{clientReference}
ConsignmentsApi getTheSpecifiedConsignmentDetailsWithMetadata GET /Consignments/getconsignmentwithmetadata/{consignmentReference}
ConsignmentsApi getTheStatusOfTheSpecifiedConsignment GET /Consignments/{consignmentReference}/status
ConsignmentsApi getTheStatusOfTheSpecifiedConsignmentSByClientReference GET /Consignments/clientReference/{clientReference}/status
ConsignmentsApi manifestConsignments PUT /Consignments/manifest
ConsignmentsApi removePackageFromConsignment POST /Consignments/{consignmentReference}/removepackage/{packageReference}
ConsignmentsApi updateConsignmentDetails PUT /Consignments/update
ConsignmentsApi updateConsignmentDetailsAlternativeRoute PUT /Consignments/
DeliveryOptionsApi getDeliveryOptionDetails GET /deliveryoptions/details/{reference}
DeliveryOptionsApi getDeliveryOptions POST /deliveryoptions/
DeliveryOptionsApi getDeliveryOptionsForExistingConsignment GET /deliveryoptions/consignment/{consignmentReference}
DeliveryOptionsApi getDeliveryOptionsSummary POST /deliveryoptions/summary
DeliveryOptionsApi getExistingDeliveryOptions GET /deliveryoptions/{reference}
DeliveryOptionsApi getPickupOptions POST /deliveryoptions/pickupoptions
DeliveryOptionsApi getPickupOptionsForExistingConsignment GET /deliveryoptions/pickupOptions/consignment/{consignmentReference}
DeliveryOptionsApi heartbeat POST /deliveryoptions/heartbeat
DeliveryOptionsApi reservePickupLocation POST /deliveryoptions/reserve/{pickupOptionReference}
DeliveryOptionsApi selectDeliveryOption POST /deliveryoptions/select/{reference}
DocumentsApi getLabelsForConsignment GET /documents/labels/{consignmentReference}
ItemsApi addItem PUT /items/{packageReference}
ItemsApi getItemByReference GET /items/{itemReference}
ItemsApi getItemsByPackage GET /items/package/{packageReference}
ItemsApi removeItemFromPackage DELETE /items/{packageReference}/{itemReference}
ItemsApi setCustomerProvidedReferenceByLabelBarcode PUT /items/{labelBarcode}/setCustomerProvidedReference
LabelGenerationApi getLabelsByConsignmentReference GET /labels/{consignmentReference}
LabelGenerationApi getLabelsByPackageReference GET /labels/{consignmentReference}/{packageReference}
LateConsignmentsApi getLateConsignmentsFromCarrierPointOfView GET /lateconsignments/carrierlate/{dateFrom}/{dateTo}
LateConsignmentsApi getLateConsignmentsFromCustomerPointOfView GET /lateconsignments/customer/{dateFrom}/{dateTo}
PackageSizesApi createPackageSize POST /packagesizes/
PackageSizesApi deletePackageSize DELETE /packagesizes/{packageSizeReference}
PackageSizesApi getDefaultPackageSize GET /packagesizes/default
PackageSizesApi getPackageSizes GET /packagesizes/
PackageSizesApi setDefaultPackageSize PUT /packagesizes/{packageSizeReference}/default
PackageSizesApi updatePackageSize PUT /packagesizes/{packageSizeReference}
PackagesApi removeAPackageFromAConsignment DELETE /Packages/{packageReference}
PackagesApi splitAPackageIntoMultiplePackages PUT /Packages/{packageReference}/split
PackagesApi updateAnExistingPackage PUT /Packages/{packageReference}
QuotesApi createQuoteForAConsignment POST /quotes/
QuotesApi getAPreviouslyGeneratedQuote GET /quotes/{quoteRequestReference}
QuotesApi getAQuoteForAnExistingConsignment GET /quotes/consignment/{consignmentReference}
QuotesProductionApi getAPreviouslyGeneratedQuote GET /Prod/Quotes/{quoteRequestReference}
QuotesProductionApi getAQuoteForAnExistingConsignment GET /Prod/Quotes/consignment/{consignmentReference}
RolesApi addAccountToRole PUT /roles/{roleReference}/accounts/{accountReference}
RolesApi createCustomRole POST /roles/custom
RolesApi deleteRole DELETE /roles/{roleReference}
RolesApi getAccountsInRole GET /roles/{roleReference}/accounts
RolesApi removeRoleFromAccount DELETE /roles/{roleReference}/accounts/{accountReference}
RolesApi updateRole PUT /roles/
SecurityApi changePassword PUT /Security/ChangePassword
SecurityApi createPasswordResetToken POST /Security/CreatePasswordReset
SecurityApi getAllPermissions GET /Security/permissions
SecurityApi setPassword PUT /Security/SetPassword
SecurityApi signOut PUT /Security/SignOut
ServiceGroupsApi createServiceGroup POST /servicegroups/
ServiceGroupsApi deleteServiceGroup DELETE /servicegroups/{serviceGroupReference}
ServiceGroupsApi getServiceGroup GET /servicegroups/{serviceGroupReference}
ServiceGroupsApi getServiceGroupSummaries GET /servicegroups/summaries
ServiceGroupsApi getServiceGroupSummary GET /servicegroups/summary/{serviceGroupReference}
ServiceGroupsApi getServiceGroups GET /servicegroups/
ServiceGroupsApi updateServiceGroup PUT /servicegroups/{serviceGroupReference}
ShippingLocationsApi getAssignedShippingLocations GET /shippingLocations/assigned
ShippingLocationsApi getShippingLocations GET /shippingLocations/
StaticDataApi getCountries GET /staticdata/countries
StaticDataApi getCurrencies GET /staticdata/currencies
StaticDataApi getPermissions GET /staticdata/permissions
StaticDataApi getTimezones GET /staticdata/timezones
StaticDataApi getTitles GET /staticdata/titles
TrackingApi getFlattenedTrackingEvents GET /tracking/flattened/{consignmentReference}
TrackingApi getTrackingEventsByClientReference GET /tracking/clientreference/{clientReference}
TrackingApi getTrackingEventsByConsignmentReference GET /tracking/{consignmentReference}

Credits

License

The MIT License (MIT). Please see License File for more information.