PHP Интерфейс Happyr\LinkedIn\LinkedInInterface

Автор: Tobias Nyholm ([email protected])
Показать файл Открыть проект

Открытые методы

Метод Описание
api ( string $method, string $resource, array $options = [] ) : mixed Make an API call. Read about what calls that are possible here: https://developer.linkedin.com/docs/rest-api.
clearStorage ( ) Clear the data storage. This will forget everything about the user and authentication process.
get ( string $resource, array $options = [] ) : mixed See docs for LinkedIn::api().
getAccessToken ( ) : Happyr\LinkedIn\AccessToken | null Returns an access token. If we do not have one in memory, try to fetch one from a *code* in the $_REQUEST.
getError ( ) : Happyr\LinkedIn\Exception\LoginError | null Returns a LoginError or null.
getLastResponse ( ) : Psr\Http\Message\ResponseInterface | null Get the last response. This will always return a PSR-7 response no matter of the data type used.
getLoginUrl ( array $options = [] ) : string Get a login URL where the user can put his/hers LinkedIn credentials and authorize the application.
hasError ( ) : boolean If the user has canceled the login we will return with an error.
isAuthenticated ( ) : boolean Is the current user authenticated?
post ( string $resource, array $options = [] ) : mixed See docs for LinkedIn::api().
setAccessToken ( string | Happyr\LinkedIn\AccessToken $accessToken ) If you have stored a previous access token in a storage (database) you could set it here. After setting an access token you have to make sure to verify it is still valid by running LinkedIn::isAuthenticated.
setFormat ( string $format ) Set the default format to use when sending requests.
setHttpClient ( Http\Client\HttpClient $client ) Set a http client.
setHttpMessageFactory ( Http\Message\MessageFactory $factory ) Set a http message factory.
setResponseDataType ( string $responseDataType ) Set the default data type to be returned as a response.
setStorage ( Happyr\LinkedIn\Storage\DataStorageInterface $storage ) Set a data storage.
setUrlGenerator ( Happyr\LinkedIn\Http\UrlGeneratorInterface $urlGenerator ) Set a URL generator.

Описание методов

api() публичный Метод

Example: $linkedIn->api('GET', '/v1/people/~:(id,firstName,lastName,headline)'); The options: - body: the body of the request - format: the format you are using to send the request - headers: array with headers to use - response_data_type: the data type to get back - query: query parameters to the request
public api ( string $method, string $resource, array $options = [] ) : mixed
$method string This is the HTTP verb
$resource string everything after the domain in the URL.
$options array See the readme for option description.
Результат mixed this depends on the response_data_type parameter.

clearStorage() публичный Метод

Clear the data storage. This will forget everything about the user and authentication process.
public clearStorage ( )

get() публичный Метод

See docs for LinkedIn::api().
public get ( string $resource, array $options = [] ) : mixed
$resource string
$options array
Результат mixed

getAccessToken() публичный Метод

Returns an access token. If we do not have one in memory, try to fetch one from a *code* in the $_REQUEST.
public getAccessToken ( ) : Happyr\LinkedIn\AccessToken | null
Результат Happyr\LinkedIn\AccessToken | null The access token of null if the access token is not found

getError() публичный Метод

Returns a LoginError or null.
public getError ( ) : Happyr\LinkedIn\Exception\LoginError | null
Результат Happyr\LinkedIn\Exception\LoginError | null

getLastResponse() публичный Метод

Get the last response. This will always return a PSR-7 response no matter of the data type used.
public getLastResponse ( ) : Psr\Http\Message\ResponseInterface | null
Результат Psr\Http\Message\ResponseInterface | null

getLoginUrl() публичный Метод

The options: - redirect_uri: the url to go to after a successful login - scope: comma (or space) separated list of requested extended permissions
public getLoginUrl ( array $options = [] ) : string
$options array Provide custom parameters
Результат string The URL for the login flow

hasError() публичный Метод

If the user has canceled the login we will return with an error.
public hasError ( ) : boolean
Результат boolean

isAuthenticated() публичный Метод

Is the current user authenticated?
public isAuthenticated ( ) : boolean
Результат boolean

post() публичный Метод

See docs for LinkedIn::api().
public post ( string $resource, array $options = [] ) : mixed
$resource string
$options array
Результат mixed

setAccessToken() публичный Метод

If you have stored a previous access token in a storage (database) you could set it here. After setting an access token you have to make sure to verify it is still valid by running LinkedIn::isAuthenticated.
public setAccessToken ( string | Happyr\LinkedIn\AccessToken $accessToken )
$accessToken string | Happyr\LinkedIn\AccessToken

setFormat() публичный Метод

Set the default format to use when sending requests.
public setFormat ( string $format )
$format string

setHttpClient() публичный Метод

Set a http client.
public setHttpClient ( Http\Client\HttpClient $client )
$client Http\Client\HttpClient

setHttpMessageFactory() публичный Метод

Set a http message factory.
public setHttpMessageFactory ( Http\Message\MessageFactory $factory )
$factory Http\Message\MessageFactory

setResponseDataType() публичный Метод

Set the default data type to be returned as a response.
public setResponseDataType ( string $responseDataType )
$responseDataType string

setStorage() публичный Метод

Set a data storage.
public setStorage ( Happyr\LinkedIn\Storage\DataStorageInterface $storage )
$storage Happyr\LinkedIn\Storage\DataStorageInterface

setUrlGenerator() публичный Метод

Set a URL generator.
public setUrlGenerator ( Happyr\LinkedIn\Http\UrlGeneratorInterface $urlGenerator )
$urlGenerator Happyr\LinkedIn\Http\UrlGeneratorInterface