Skip to content

Latest commit

 

History

History
231 lines (189 loc) · 8.57 KB

README.md

File metadata and controls

231 lines (189 loc) · 8.57 KB

Deliveree-php-sdk

With Deliveree SDK, developers can integrate our on-demand local delivery platform into their applications. The SDK is designed for developers to check prices, book an immediate or scheduled delivery and follow updates until delivery completion.

  • SDK version: 1.0.0

Requirements

    // More example look at dist folder

Installation & Usage

Note: there are two ways to adding package in to your project:

1. Using Composer

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

{
    "repositories": [
        {
            "type": "path",
            // link to your php sdk source
            "url": "(C:/sdk...)/deliveree-php-sdk/deliveree-sdk",
            "options": {
                "symlink": true
              }
        }

    ]
  "require": {
    // 
    "deliveree-php-sdk/delivere-sdk": "*@dev"
  }
}

Then run composer install

2. Manual Installation

Manual require file

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

Getting Started

<?php
require_once('/path/to/deliveree-php-sdk/deliveree-sdk/vendor/autoload.php');

## Example 1 Cancel Booking
// Configure API key authorization: ApiKeyAuth
$config = Configuration::getDefaultConfiguration()->setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');

$apiInstance = new DelivereeApi(
    // 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
);
$id = 56; // int | ID of delivery
$accept_language = "accept_language_example"; // string | 

try {
    $apiInstance->cancelBooking($id, $accept_language);
} catch (Exception $e) {
    echo 'Exception when calling DelivereeApi->cancelBooking: ', $e->getMessage(), PHP_EOL;
}

## Example 2 Get Quote 
// Configure API key authorization: ApiKeyAuth
$config = Configuration::getDefaultConfiguration()->setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');

$apiInstance = new DelivereeApi(
    // 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
);
$body = new Quote(); // Quote | 
$accept_language = "accept_language_example"; // string | 

try {
    $result = $apiInstance->deliveriesGetQuotePost($body, $accept_language);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling DelivereeApi->deliveriesGetQuotePost: ', $e->getMessage(), PHP_EOL;
}

## Example 3 Create Booking or Delivery
// Configure API key authorization: ApiKeyAuth
$config = Configuration::getDefaultConfiguration()->setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');

$apiInstance = new Deliveree\Client\Api\DelivereeApi(
    // 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
);
$body = new Delivery(); // Delivery | 
$accept_language = "accept_language_example"; // string | 

try {
    $result = $apiInstance->deliveriesPost($body, $accept_language);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling DelivereeApi->deliveriesPost: ', $e->getMessage(), PHP_EOL;
}

## Example 4 Get Deliveries
// Configure API key authorization: ApiKeyAuth
$config = Configuration::getDefaultConfiguration()->setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');

$apiInstance = new Deliveree\Client\Api\DelivereeApi(
    // 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
);

$delivery_id = 3000; // {Number} ID of delivery
$accept_language = "accept_language_example"; // string | 

try {
    $result = $apiInstance->deliveriesGet($delivery_id,$accept_language);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling DelivereeApi->deliveriesGet: ', $e->getMessage(), PHP_EOL;
}

## Example 5 Get delivery booking list
// Configure API key authorization: ApiKeyAuth
$config = Configuration::getDefaultConfiguration()->setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');

$apiInstance = new Deliveree\Client\Api\DelivereeApi(
    // 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
);
$params = (object)[
            'page' => 1, // {Number}
            'per_page' => 10, // {Number}
        ];
$accept_language = "accept_language_example"; // string | 

try {
    $result = $apiInstance->deliveriesGetList($params,$accept_language);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling DelivereeApi->deliveriesGetList: ', $e->getMessage(), PHP_EOL;
}

## Example 6 Get vehicle types
// Configure API key authorization: ApiKeyAuth
$config = Configuration::getDefaultConfiguration()->setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');

$apiInstance = new Deliveree\Client\Api\DelivereeApi(
    // 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
);

$accept_language = "accept_language_example"; // string | 

try {
    $result = $apiInstance->vehicleTypesGet($accept_language);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling DelivereeApi->vehicleTypesGet: ', $e->getMessage(), PHP_EOL;
}
?>

Documentation for SDK APIs Endpoints

There are 4 methods provide for each APIs in PHP sdk with different Result value:

Api Description
deliveriesGetQuotePost * return object *
deliveriesGetQuotePostWithHttpInfo return array of object, HTTP status code, HTTP response headers (array of strings)
deliveriesGetQuotePostAsync return array of @Object \GuzzleHttp\Promise\PromiseInterface
deliveriesGetQuotePostAsyncWithHttpInfo *return @Object \GuzzleHttp\Promise\PromiseInterface *
... ...

All URIs are relative to PHP sdk

Class Method HTTP request Description
DelivereeApi cancelBooking POST /deliveries/{id}/cancel
DelivereeApi deliveriesGetQuotePost POST /deliveries/get_quote
DelivereeApi deliveriesPost POST /deliveries
DelivereeApi deliveriesGet GET /deliveries/{id}
DelivereeApi deliveriesGetList GET /deliveries
DelivereeApi vehicleTypesGet GET /vehicle_types

Documentation For Models

Documentation For ApiKeyAuth Authorization

  • Type: API key
  • API key parameter name: Authorization
  • Location: HTTP header

Author

[email protected]