Larabros\Elogram\Client

class Client

Elogram client class.

constant API_VERSION

The current version of the API.

property container

protected ContainerInterface

The application IoC container.

__construct($clientId, $clientSecret, $accessToken = null, $redirectUrl = '', $options =[])

Create an instance of Client.

Parameters:
  • $clientId
  • $clientSecret
  • $accessToken
  • $redirectUrl
  • $options
buildContainer($options)

Takes the constructor parameters and uses them to instantiate and build a Container object.

Parameters:
  • $options
Returns:

ContainerInterface

users()

Returns the current instance of UsersRepository.

Returns:UsersRepository
media()

Returns the current instance of MediaRepository.

Returns:MediaRepository
comments()

Returns the current instance of CommentsRepository.

Returns:CommentsRepository
likes()

Returns the current instance of LikesRepository.

Returns:LikesRepository
tags()

Returns the current instance of TagsRepository.

Returns:TagsRepository
locations()

Returns the current instance of LocationsRepository.

Returns:LocationsRepository
request($method, $uri, $parameters =[])

Sends a request.

Parameters:
  • $method (string) –
  • $uri (string) –
  • $parameters
Returns:

Response

paginate(Response $response, $limit = null)

Paginates a Response.

Parameters:
Returns:

Response

getLoginUrl($options =[])

Gets the login URL.

Parameters:
  • $options (array) –
Returns:

string

getAccessToken($code, $grant = 'authorization_code')

Sets and returns the access token.

Parameters:
  • $code (string) –
  • $grant (string) –
Returns:

AccessToken

setAccessToken(AccessToken $token)

Sets an access token and adds it to AuthMiddleware so the application can make authenticated requests.

Parameters:
  • $token (AccessToken) –
Returns:

unknown void

secureRequests($enable = true)

Enables or disables secure requests by adding or removing SecureRequestMiddleware.

Parameters:
  • $enable (bool) –
Returns:

unknown void