PHP Interface Happyr\LinkedIn\LinkedInInterface

Author: Tobias Nyholm ([email protected])
Afficher le fichier Open project: happyr/linkedin-api-client

Méthodes publiques

Méthode Description
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.

Method Details

api() public méthode

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.
Résultat mixed this depends on the response_data_type parameter.

clearStorage() public méthode

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

get() public méthode

See docs for LinkedIn::api().
public get ( string $resource, array $options = [] ) : mixed
$resource string
$options array
Résultat mixed

getAccessToken() public méthode

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
Résultat Happyr\LinkedIn\AccessToken | null The access token of null if the access token is not found

getError() public méthode

Returns a LoginError or null.
public getError ( ) : Happyr\LinkedIn\Exception\LoginError | null
Résultat Happyr\LinkedIn\Exception\LoginError | null

getLastResponse() public méthode

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
Résultat Psr\Http\Message\ResponseInterface | null

getLoginUrl() public méthode

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
Résultat string The URL for the login flow

hasError() public méthode

If the user has canceled the login we will return with an error.
public hasError ( ) : boolean
Résultat boolean

isAuthenticated() public méthode

Is the current user authenticated?
public isAuthenticated ( ) : boolean
Résultat boolean

post() public méthode

See docs for LinkedIn::api().
public post ( string $resource, array $options = [] ) : mixed
$resource string
$options array
Résultat mixed

setAccessToken() public méthode

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() public méthode

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

setHttpClient() public méthode

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

setHttpMessageFactory() public méthode

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

setResponseDataType() public méthode

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

setStorage() public méthode

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

setUrlGenerator() public méthode

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