Overview

Namespaces

  • Docta
    • MercadoLibre
      • Exception
      • OAuth2
        • Client
          • Test
  • GuzzleHttp
    • Cookie
    • Exception
    • Handler
    • Promise
      • Test
      • Tests
    • Psr7
    • Test
      • Handler
    • Tests
      • CookieJar
      • Event
      • Exception
      • Handler
      • Promise
      • Psr7
  • League
    • OAuth2
      • Client
        • Grant
          • Exception
        • Provider
          • Exception
        • Test
          • Grant
          • Provider
            • Exception
            • Fake
          • Token
          • Tool
        • Token
        • Tool
  • None
  • Psr
    • Http
      • Message

Classes

  • Client
  • Overview
  • Namespace
  • Class
  • Download

Class Client

Represents a simplified version of MercadoLibre Provider.

League\OAuth2\Client\Provider\AbstractProvider uses League\OAuth2\Client\Tool\ArrayAccessorTrait, League\OAuth2\Client\Tool\QueryBuilderTrait
Extended by Docta\MercadoLibre\OAuth2\Client\Provider uses League\OAuth2\Client\Tool\BearerAuthorizationTrait
Extended by Docta\MercadoLibre\Client
Namespace: Docta\MercadoLibre
Located at Client.php
Methods summary
public
# __construct( string $authSite, string $clientId, string $clientSecret, string $redirectUri, League\OAuth2\Client\Token\AccessToken|string $token = null )

Constructor.

Constructor.

Parameters

$authSite
The site where the application was registered (ex: MLA)
$clientId
The App ID granted by MercadoLibre
$clientSecret
The secret key granted by MercadoLibre
$redirectUri
The URI that will process the MercadoLibre callback
$token
Code or token previously granted (optional)

Throws

InvalidArgumentException
Docta\MercadoLibre\Exception\ClientException

Overrides

Docta\MercadoLibre\OAuth2\Client\Provider::__construct()
public string
# getAuthorizationUrl( array $options = [] )

Builds and returns the authorization URL.

Builds and returns the authorization URL.

Parameters

$options

Returns

string
Authorization URL

Overrides

Docta\MercadoLibre\OAuth2\Client\Provider::getAuthorizationUrl()
public string
# getState( )

Returns the current value of the state parameter.

Returns the current value of the state parameter.

Returns

string

Overrides

League\OAuth2\Client\Provider\AbstractProvider::getState()
public League\OAuth2\Client\Token\AccessToken|null
# setToken( League\OAuth2\Client\Token\AccessToken|string $token )

Set a token using a code or a previously created token.

Set a token using a code or a previously created token.

Parameters

$token
Code or token previously granted

Returns

League\OAuth2\Client\Token\AccessToken|null

Throws

Docta\MercadoLibre\Exception\ClientException
public League\OAuth2\Client\Token\AccessToken|null
# getToken( )

Get the current token.

Get the current token.

Returns

League\OAuth2\Client\Token\AccessToken|null

Throws

Docta\MercadoLibre\Exception\ClientException
public Docta\MercadoLibre\OAuth2\Client\ResourceOwner|null
# getOwner( )

Get the owner resource for the current token.

Get the owner resource for the current token.

Returns

Docta\MercadoLibre\OAuth2\Client\ResourceOwner|null

Throws

Docta\MercadoLibre\Exception\ClientException
public Docta\MercadoLibre\OAuth2\Client\ResourceGeneric
# get( string $path, array $query = [] )

Execute a GET request

Execute a GET request

Parameters

$path
Path relative to the API URL
$query
Query parameters to include in the URL (optional)

Returns

Docta\MercadoLibre\OAuth2\Client\ResourceGeneric
The resource obtained by the request

Throws

Docta\MercadoLibre\Exception\ClientException
public Docta\MercadoLibre\OAuth2\Client\ResourceGeneric
# post( string $path, array $data = [], array $query = [] )

Execute a POST request

Execute a POST request

Parameters

$path
Path relative to the API URL
$data
Data to be sent through the HTTP headers (optional)
$query
Query parameters to include in the URL (optional)

Returns

Docta\MercadoLibre\OAuth2\Client\ResourceGeneric
The resource obtained by the request

Throws

Docta\MercadoLibre\Exception\ClientException
public Docta\MercadoLibre\OAuth2\Client\ResourceGeneric
# put( string $path, array $data = [], array $query = [] )

Execute a PUT request

Execute a PUT request

Parameters

$path
Path relative to the API URL
$data
Data to be sent through the HTTP headers (optional)
$query
Query parameters to include in the URL (optional)

Returns

Docta\MercadoLibre\OAuth2\Client\ResourceGeneric
The resource obtained by the request

Throws

Docta\MercadoLibre\Exception\ClientException
public Docta\MercadoLibre\OAuth2\Client\ResourceGeneric
# delete( string $path, array $query = [] )

Execute a DELETE request

Execute a DELETE request

Parameters

$path
Path relative to the API URL
$query
Query parameters to include in the URL (optional)

Returns

Docta\MercadoLibre\OAuth2\Client\ResourceGeneric
The resource obtained by the request

Throws

Docta\MercadoLibre\Exception\ClientException
public Docta\MercadoLibre\OAuth2\Client\ResourceGeneric
# options( string $path, array $query = [] )

Execute a OPTIONS request

Execute a OPTIONS request

Parameters

$path
Path relative to the API URL
$query
Query parameters to include in the URL (optional)

Returns

Docta\MercadoLibre\OAuth2\Client\ResourceGeneric
The resource obtained by the request

Throws

Docta\MercadoLibre\Exception\ClientException
public Docta\MercadoLibre\OAuth2\Client\ResourceGeneric
# execute( string $method, string $path, array $query = [], array $data = [] )

Execute a custom request

Execute a custom request

Parameters

$method
Request method
$path
Path relative to the API URL
$query
Query parameters to include in the URL (optional)
$data
Data to be sent through the HTTP headers (optional)

Returns

Docta\MercadoLibre\OAuth2\Client\ResourceGeneric
The resource obtained by the request

Throws

Docta\MercadoLibre\Exception\ClientException
public Psr\Http\Message\RequestInterface
# buildRequest( string $method, string $url, array $data = [] )

Build and return an appropriate request.

Build and return an appropriate request.

Parameters

$method
$url
$data

Returns

Psr\Http\Message\RequestInterface
public Docta\MercadoLibre\OAuth2\Client\ResourceGeneric|mixed
# buildResource( mixed $response = null )

Build and return a resource.

Build and return a resource.

Parameters

$response

Returns

Docta\MercadoLibre\OAuth2\Client\ResourceGeneric|mixed
protected
# checkResponse( Psr\Http\Message\ResponseInterface $response, array|string $data )

Checks a provider response for errors.

Checks a provider response for errors.

Parameters

$response
$data
Parsed response data

Throws

Docta\MercadoLibre\Exception\ClientException

Overrides

Docta\MercadoLibre\OAuth2\Client\Provider::checkResponse()
Methods inherited from Docta\MercadoLibre\OAuth2\Client\Provider
createResourceOwner(), getAccessTokenResourceOwnerId(), getApiUrl(), getAuthenticatedRequest(), getBaseAccessTokenUrl(), getBaseAuthorizationUrl(), getDefaultScopes(), getRequiredOptions(), getResourceOwnerDetailsUrl()
Methods inherited from League\OAuth2\Client\Provider\AbstractProvider
appendQuery(), authorize(), createAccessToken(), createRequest(), fetchResourceOwnerDetails(), getAccessToken(), getAccessTokenBody(), getAccessTokenMethod(), getAccessTokenOptions(), getAccessTokenQuery(), getAccessTokenRequest(), getAccessTokenUrl(), getAllowedClientOptions(), getAuthorizationHeaders(), getAuthorizationParameters(), getAuthorizationQuery(), getContentType(), getDefaultHeaders(), getGrantFactory(), getHeaders(), getHttpClient(), getParsedResponse(), getRandomState(), getRequest(), getRequestFactory(), getResourceOwner(), getResponse(), getScopeSeparator(), parseJson(), parseResponse(), prepareAccessTokenResponse(), setGrantFactory(), setHttpClient(), setRequestFactory(), verifyGrant()
Methods used from League\OAuth2\Client\Tool\BearerAuthorizationTrait
getAuthorizationHeaders()
Methods used from League\OAuth2\Client\Tool\QueryBuilderTrait
buildQueryString()
Constants inherited from League\OAuth2\Client\Provider\AbstractProvider
ACCESS_TOKEN_RESOURCE_OWNER_ID, METHOD_GET, METHOD_POST
Properties summary
protected League\OAuth2\Client\Token\AccessToken $token
#
protected Docta\MercadoLibre\OAuth2\Client\ResourceOwner $owner
#
Properties inherited from Docta\MercadoLibre\OAuth2\Client\Provider
$apiUrl, $authSite, $authSites, $authUrl
Properties inherited from League\OAuth2\Client\Provider\AbstractProvider
$clientId, $clientSecret, $grantFactory, $httpClient, $redirectUri, $requestFactory, $state
MercadoLibre PHP SDK API documentation generated by ApiGen