2017 © Pedro Peláez
 

library mpapi-client

Mall marketplace API client

image

mallgroup/mpapi-client

Mall marketplace API client

  • Friday, July 13, 2018
  • by jan.blaha.mall
  • Repository
  • 3 Watchers
  • 3 Stars
  • 15,679 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 5 Forks
  • 2 Open issues
  • 71 Versions
  • 12 % Grown

The README.md

License PHPStan Psalm, (*1)

Mall Marketplace API Client

Description

MPAPI client is a tool created to help Internet Mall, a. s. partners easily manage article catalogue, deliveries, orders etc. using Mall Marketplace API., (*2)

Requirements

  • 64bit version of PHP 7.4 or PHP 8
  • Guzzle 7

Installation

To install the client using Composer run following command in your repository, (*3)

composer require mallgroup/mpapi-client

Implementation

Info

Client consists of one main client and multiple, separate, domain clients., (*4)

The main client groups all domain clients under one object, for easier implementation, but every domain client can be initialized and used by itself., (*5)

Every client provides an interface that SHOULD be used as parameter types in code, instead of client classes themselves (i.e., use MpApiClientInterface $client or BrandsClientInterface $client instead of MpApiClient $client or BrandsClient $client)., (*6)

When initializing the client, you MUST provide, (*7)

  1. an authenticator implementing AuthMiddlewareInterface
    • currently, only ClientIdAuthenticator, which accepts my-client-id, is provided
    • in the future, new authenticators will be released (i.e., OAuth)
  2. name of the app using the API
    • it is sent with every request to Mall API for easier request identification and debugging of reported issues
    • please provide a simple, yet meaningful name, i.e., MyAppName CRM or MyAppName Order sync instead of a random string

Examples

There are 2 main ways to initialize the client, (*8)

1. Using MpApiClient with default config

<?php declare(strict_types=1);

use MpApiClient\Common\Authenticators\ClientIdAuthenticator;
use MpApiClient\MpApiClient;
use MpApiClient\MpApiClientOptions;

require 'vendor/autoload.php';

// 1. Initialize client options with request authenticator
$options = new MpApiClientOptions(
    new ClientIdAuthenticator('my-client-id')
);

// 2. Initialize MP API Client
$client = MpApiClient::createFromOptions('my-app-name', $options);

// 3. Get brand client
$brandClient = $client->brand();

2. Using MpApiClient (or any other domain client) with custom http client

  • every domain client can be initialized this way as a standalone client
  • when initializing a custom http client, handler stack with AuthMiddlewareInterface MUST be provided!
<?php declare(strict_types=1);

use GuzzleHttp\Client;
use GuzzleHttp\Handler\CurlHandler;
use GuzzleHttp\HandlerStack;
use MpApiClient\Brand\BrandClient;
use MpApiClient\Common\Authenticators\ClientIdAuthenticator;
use MpApiClient\MpApiClient;
use MpApiClient\MpApiClientOptions;

require 'vendor/autoload.php';

// 1. Initialize request authenticator
$authenticator = new ClientIdAuthenticator('my-client-id');

// 2. Create custom Guzzle http client with authenticator middleware

// 2.1 Create CurlHandler stack and Guzzle http client manually
$handler      = new CurlHandler();
$handlerStack = HandlerStack::create($handler);
$handlerStack->push($authenticator->getHandler());

$httpClient = new Client(
    [
        'base_uri'        => 'https://mpapi.mallgroup.com/v1/',
        'timeout'         => 10,
        'allow_redirects' => true,
        'handler'         => $handlerStack,
    ]
);

// 2.2. Create Guzzle client using MpApiClientOptions object
$options = new MpApiClientOptions($authenticator);
$options->setTimeout(30);

$httpClient = new Client($options->getGuzzleOptionsArray());

// 3. Create MpApiClient and BrandClient using custom Guzzle client
$client      = new MpApiClient($httpClient, 'my-app-name')
$brandClient = new BrandClient($httpClient, 'my-app-name')

Examples for all client domains

List of custom Exceptions thrown in this client can be found here, (*9)

⚠ Warning

  • client does not include support for deprecated endpoints that will be changed, replaced or removed in the future (i.e., /v1/deliveries or /v1/gifts)

ℹ Known missing or incomplete features

  • [ ] Support for /v2/transports endpoints

The Versions

13/07 2018

dev-master

9999999-dev

Mall marketplace API client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan Blaha
by Jonas Habr
by Martin Drlik
by Martin Hrdlicka

13/07 2018

3.1.0

3.1.0.0

Mall marketplace API client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan Blaha
by Martin Drlik

27/04 2018

3.0.0

3.0.0.0

Mall marketplace API client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan Blaha
by Martin Drlik

27/04 2018

dev-remove-delivery-settings

dev-remove-delivery-settings

Mall marketplace API client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan Blaha
by Martin Drlik

15/03 2018

2.16.2

2.16.2.0

Mall marketplace API client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan Blaha
by Martin Drlik

14/02 2018

2.15.0

2.15.0.0

Mall marketplace API client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan Blaha
by Martin Drlik

15/12 2017

2.14.2

2.14.2.0

Mall marketplace API client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan Blaha
by Martin Drlik

06/11 2017

2.14.1

2.14.1.0

Mall marketplace API client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan Blaha
by Martin Drlik

04/10 2017

2.14.0

2.14.0.0

Mall marketplace API client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan Blaha
by Martin Drlik

26/09 2017

2.13.0

2.13.0.0

Mall marketplace API client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan Blaha
by Martin Drlik

25/09 2017

2.12.2

2.12.2.0

Mall marketplace API client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan Blaha
by Martin Drlik

21/09 2017

2.12.1

2.12.1.0

Mall marketplace API client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan Blaha
by Martin Drlik

08/09 2017

2.12.0

2.12.0.0

Mall marketplace API client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan Blaha
by Martin Drlik

07/09 2017

2.11.6

2.11.6.0

Mall marketplace API client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan Blaha
by Martin Drlik

04/09 2017

2.11.5

2.11.5.0

Mall marketplace API client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan Blaha
by Martin Drlik

04/09 2017

2.11.4

2.11.4.0

Mall marketplace API client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan Blaha
by Martin Drlik

30/08 2017

2.11.3

2.11.3.0

Mall marketplace API client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan Blaha
by Martin Drlik

25/08 2017

2.11.2

2.11.2.0

Mall marketplace API client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan Blaha
by Martin Drlik

24/08 2017

2.11.1

2.11.1.0

Mall marketplace API client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan Blaha
by Martin Drlik

16/08 2017

2.11.0

2.11.0.0

Mall marketplace API client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan Blaha
by Jonas Habr
by Martin Drlik

09/08 2017

2.10.2

2.10.2.0

Mall marketplace API client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan Blaha
by Jonas Habr
by Martin Drlik

24/05 2017

2.10.0

2.10.0.0

Mall marketplace API client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan Blaha
by Jonas Habr
by Martin Drlik

11/05 2017

2.9.0

2.9.0.0

Mall marketplace API client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan Blaha
by Jonas Habr
by Martin Drlik
by Martin Hrdlicka

27/04 2017

2.8.0

2.8.0.0

Mall marketplace API client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan Blaha
by Jonas Habr
by Martin Drlik
by Martin Hrdlicka

05/04 2017

2.7.0

2.7.0.0

Mall marketplace API client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan Blaha
by Jonas Habr
by Martin Drlik
by Martin Hrdlicka

28/03 2017

2.6.1

2.6.1.0

Mall marketplace API client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan Blaha
by Jonas Habr
by Martin Drlik
by Martin Hrdlicka

27/03 2017

2.6.0

2.6.0.0

Mall marketplace API client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan Blaha
by Jonas Habr
by Martin Drlik
by Martin Hrdlicka

27/03 2017

2.5.1

2.5.1.0

Mall marketplace API client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan Blaha
by Jonas Habr
by Martin Drlik
by Martin Hrdlicka

14/03 2017

2.4.0

2.4.0.0

Mall marketplace API client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan Blaha
by Jonas Habr
by Martin Drlik
by Martin Hrdlicka

08/03 2017

2.3.6

2.3.6.0

Mall marketplace API client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan Blaha
by Jonas Habr
by Martin Drlik
by Martin Hrdlicka

27/02 2017

2.3.5

2.3.5.0

Mall marketplace API client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan Blaha
by Jonas Habr
by Martin Drlik
by Martin Hrdlicka

22/02 2017

2.3.4

2.3.4.0

Mall marketplace API client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan Blaha
by Jonas Habr
by Martin Drlik
by Martin Hrdlicka

20/02 2017

2.3.3

2.3.3.0

Mall marketplace API client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan Blaha
by Jonas Habr
by Martin Drlik
by Martin Hrdlicka

20/02 2017

2.3.2

2.3.2.0

Mall marketplace API client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan Blaha
by Jonas Habr
by Martin Drlik
by Martin Hrdlicka

20/02 2017

2.3.1

2.3.1.0

Mall marketplace API client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan Blaha
by Jonas Habr
by Martin Drlik
by Martin Hrdlicka

17/02 2017

2.3.0

2.3.0.0

Mall marketplace API client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan Blaha
by Jonas Habr
by Martin Drlik
by Martin Hrdlicka

15/02 2017

2.2.0

2.2.0.0

Mall marketplace API client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan Blaha
by Jonas Habr
by Martin Drlik
by Martin Hrdlicka

14/02 2017

2.1.4

2.1.4.0

Mall marketplace API client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan Blaha
by Jonas Habr
by Martin Drlik
by Martin Hrdlicka

08/02 2017

2.1.3

2.1.3.0

Mall marketplace API client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan Blaha
by Jonas Habr
by Martin Drlik
by Martin Hrdlicka

03/02 2017

2.1.2

2.1.2.0

Mall marketplace API client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan Blaha
by Jonas Habr
by Martin Drlik
by Martin Hrdlicka

25/01 2017

2.1.1

2.1.1.0

Mall marketplace API client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan Blaha
by Jonas Habr
by Martin Drlik
by Martin Hrdlicka

24/01 2017

2.1.0

2.1.0.0

Mall marketplace API client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan Blaha
by Jonas Habr
by Martin Drlik
by Martin Hrdlicka

16/01 2017

2.0.9

2.0.9.0

Mall marketplace API client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan Blaha
by Jonas Habr
by Martin Drlik
by Martin Hrdlicka

16/01 2017

2.0.8

2.0.8.0

Mall marketplace API client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan Blaha
by Jonas Habr
by Martin Drlik
by Martin Hrdlicka

16/01 2017

2.0.7

2.0.7.0

Mall marketplace API client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan Blaha
by Jonas Habr
by Martin Drlik
by Martin Hrdlicka

02/01 2017

2.0.6

2.0.6.0

Mall marketplace API client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan Blaha
by Jonas Habr
by Martin Drlik
by Martin Hrdlicka

23/12 2016

2.0.5

2.0.5.0

Mall marketplace API client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan Blaha
by Jonas Habr
by Martin Drlik
by Martin Hrdlicka

22/12 2016

2.0.4

2.0.4.0

Mall marketplace API client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan Blaha
by Jonas Habr
by Martin Drlik
by Martin Hrdlicka

22/12 2016

2.0.3

2.0.3.0

Mall marketplace API client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan Blaha
by Jonas Habr
by Martin Drlik
by Martin Hrdlicka

20/12 2016

2.0.2

2.0.2.0

Mall marketplace API client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan Blaha
by Jonas Habr
by Martin Drlik
by Martin Hrdlicka

09/12 2016

2.0.1

2.0.1.0

Mall marketplace API client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan Blaha
by Jonas Habr
by Martin Drlik
by Martin Hrdlicka

30/11 2016

2.0.0

2.0.0.0

Mall marketplace API client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan Blaha
by Jonas Habr
by Martin Drlik
by Martin Hrdlicka

30/11 2016

1.9.7

1.9.7.0

Mall marketplace API client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan Blaha
by Jonas Habr
by Martin Drlik
by Martin Hrdlicka

30/11 2016

1.9.5

1.9.5.0

Mall marketplace API client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan Blaha
by Jonas Habr
by Martin Drlik
by Martin Hrdlicka

22/11 2016

1.9.4

1.9.4.0

Mall marketplace API client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan Blaha
by Jonas Habr
by Martin Drlik
by Martin Hrdlicka

01/11 2016

1.9.3

1.9.3.0

Mall marketplace API client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan Blaha
by Jonas Habr
by Martin Drlik
by Martin Hrdlicka

01/11 2016

1.9.2

1.9.2.0

Mall marketplace API client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan Blaha
by Jonas Habr
by Martin Drlik
by Martin Hrdlicka

31/10 2016

1.9.1

1.9.1.0

Mall marketplace API client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan Blaha
by Jonas Habr
by Martin Drlik
by Martin Hrdlicka

27/10 2016

1.9.0

1.9.0.0

Mall marketplace API client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan Blaha
by Jonas Habr
by Martin Drlik
by Martin Hrdlicka

24/10 2016

1.8

1.8.0.0

Mall marketplace API client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan Blaha
by Jonas Habr
by Martin Drlik
by Martin Hrdlicka

18/10 2016

1.7.1

1.7.1.0

Mall marketplace API client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan Blaha
by Jonas Habr
by Martin Drlik
by Martin Hrdlicka

04/10 2016

1.6.3

1.6.3.0

Mall marketplace API client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan Blaha
by Jonas Habr
by Martin Drlik
by Martin Hrdlicka

04/10 2016

1.6.2

1.6.2.0

Mall marketplace API client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan Blaha
by Jonas Habr
by Martin Drlik
by Martin Hrdlicka

21/09 2016

1.6.1

1.6.1.0

Mall marketplace API client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan Blaha
by Jonas Habr
by Martin Drlik
by Martin Hrdlicka

07/09 2016

1.5.0

1.5.0.0

Mall marketplace API client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan Blaha
by Jonas Habr
by Martin Drlik
by Martin Hrdlicka

05/09 2016

1.4.1

1.4.1.0

Mall marketplace API client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan Blaha
by Jonas Habr
by Martin Drlik
by Martin Hrdlicka

23/08 2016

1.3.1

1.3.1.0

Mall marketplace API client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan Blaha
by Jonas Habr

23/08 2016

1.3.0

1.3.0.0

Mall marketplace API client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan Blaha
by Jonas Habr

09/08 2016

v1.6

1.6.0.0

Mall marketplace API client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan Blaha
by Jonas Habr

09/08 2016

v1.4

1.4.0.0

Mall marketplace API client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan Blaha
by Jonas Habr

09/08 2016

v1.2

1.2.0.0

Mall marketplace API client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan Blaha
by Jonas Habr