chrishemmings / electio

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

.

A minimal Electio client

This PHP package is automatically generated by the Swagger Codegen project:

  • API version: 1.0.12
  • Package version: 1.0.0
  • Build package: io.swagger.codegen.languages.PhpClientCodegen

Requirements

PHP 5.5 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.git"
    }
  ],
  "require": {
    "chrishemmings/electio": "*@dev"
  }
}

Then run composer install

Manual Installation

Download the files and include autoload.php:

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

Tests

To run the unit tests:

composer install
./vendor/bin/phpunit

Getting Started

Please follow the installation procedure and then run the following:

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

// Configure API key authorization: Ocp-Apim-Subscription-Key
$config = ChrisHemmings\Electio\Configuration::getDefaultConfiguration()->setApiKey('Ocp-Apim-Subscription-Key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = ChrisHemmings\Electio\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Ocp-Apim-Subscription-Key', 'Bearer');

$apiInstance = new ChrisHemmings\Electio\Api\AllocationApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$electio_api_version = "1.1"; // string | Electio API Version
$allocation = new \ChrisHemmings\Electio\Client\Model\AllocateWithCarrierService(); // \ChrisHemmings\Electio\Client\Model\AllocateWithCarrierService | Consignment to create

try {
    $result = $apiInstance->allocateWithCarrierService($electio_api_version, $allocation);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling AllocationApi->allocateWithCarrierService: ', $e->getMessage(), PHP_EOL;
}

?>

Documentation for API Endpoints

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

Class Method HTTP request Description
AllocationApi allocateWithCarrierService PUT /allocation/allocateWithCarrierService Allocate a consignment to a specified delivery service
AllocationApi allocateWithQuote PUT /allocation/{consignmentReference}/allocatewithquote/{quoteReference} Allocate consignment using quote reference
CarriersApi carriers GET /carriers/getcarriers Get carriers
ConsignmentApi createConsignment POST /consignments Create a consignment
ConsignmentApi getConsignment GET /consignments/{consignmentReference} Fetch a consignment by reference
ConsignmentApi getConsignmentSummary GET /consignments/summary Fetch a summary of consignment statuses
ConsignmentApi getConsignmentWithMetadata GET /consignments/getconsignmentwithmetadata/{consignmentReference} Fetch a consignment by reference with metadata
ConsignmentApi searchConsignments GET /consignments/{take}/{skip} Search for consignments
DeliveryOptionsApi getConsignmentDeliveryOptions GET /deliveryoptions/consignment/{consignmentReference} Fetch delivery options for a consignment
DeliveryOptionsApi getDeliveryOptions POST /deliveryoptions Get delivery options for passed consignment details
DeliveryOptionsApi getDeliveryOptionsHeartbeat POST /deliveryoptions/heartbeat Get delivery options for passed consignment details
DeliveryOptionsApi selectDeliveryOption POST /deliveryoptions/select/{deliveryOptionReference} Use a delivery option that was generated from a previous call to /deliveryoptions
DocumentsApi getConsignmentDocuments GET /consignments/docs/{consignmentReference} Fetch customs documents
DocumentsApi getConsignmentLabels GET /documents/labels/{consignmentReference} Fetch labels for a specified consignment
DocumentsApi getPackageDocument GET /consignments/docs/{customsDocumentType}/{consignmentReference}/{packageReference} Fetch specific document type for given Parcel and Package
ManifestingApi manifest PUT /consignments/manifest Manifest the passed consignment numbers
QuotesApi getQuotes POST /quotes Get delivery option quotes
TrackingApi getConsignmentTracking GET /tracking/{consignmentReference} Fetch tracking information for given reference

Documentation For Models

Documentation For Authorization

Ocp-Apim-Subscription-Key

  • Type: API key
  • API key parameter name: Ocp-Apim-Subscription-Key
  • Location: HTTP header

Author

chris@hemmin.gs

About

License:Apache License 2.0


Languages

Language:PHP 100.0%Language:Shell 0.0%