PHP 클래스 seregazhuk\PinterestBot\Api\Request

상속: implements seregazhuk\PinterestBot\Interfaces\RequestInterface
파일 보기 프로젝트 열기: seregazhuk/php-pinterest-bot 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$csrfToken string
$filePathToUpload string
$httpClient seregazhuk\PinterestBot\Api\Contracts\HttpClient
$lastError array | null
$loggedIn boolean
$postFileData string
$requestHeaders array Common headers needed for every query.

공개 메소드들

메소드 설명
__construct ( seregazhuk\PinterestBot\Api\Contracts\HttpClient $http )
autoLogin ( string $username ) : boolean Load cookies for this username and check if it was logged in.
clearToken ( ) Clear token information.
createQuery ( array $data = [], array $bookmarks = [] ) : string Create request string.
createRequestData ( array $data = [], array $bookmarks = [] ) : array
exec ( string $resourceUrl, string $postString = '' ) : string Executes request to Pinterest API.
getHttpClient ( ) : seregazhuk\PinterestBot\Api\Contracts\HttpClient
getLastError ( ) : array | null
isLoggedIn ( ) : boolean Get current auth status.
login ( ) Mark client as logged.
logout ( ) Mark client as logged out.
setTokenFromCookies ( ) Trying to get csrf token from cookies.
upload ( string $pathToFile, string $url ) : string

보호된 메소드들

메소드 설명
buildFilePostData ( string $delimiter )
getContentTypeHeader ( ) : array If we are uploading file, we should build boundary form data. Otherwise it is simple urlencoded form.
getDefaultHttpHeaders ( ) : array
getHttpHeaders ( ) : array
makeHeadersForUpload ( ) : array

메소드 상세

__construct() 공개 메소드

public __construct ( seregazhuk\PinterestBot\Api\Contracts\HttpClient $http )
$http seregazhuk\PinterestBot\Api\Contracts\HttpClient

autoLogin() 공개 메소드

Load cookies for this username and check if it was logged in.
public autoLogin ( string $username ) : boolean
$username string
리턴 boolean

buildFilePostData() 보호된 메소드

protected buildFilePostData ( string $delimiter )
$delimiter string

clearToken() 공개 메소드

Clear token information.
public clearToken ( )

createQuery() 공개 정적인 메소드

Create request string.
public static createQuery ( array $data = [], array $bookmarks = [] ) : string
$data array
$bookmarks array
리턴 string

createRequestData() 공개 정적인 메소드

public static createRequestData ( array $data = [], array $bookmarks = [] ) : array
$data array
$bookmarks array
리턴 array

exec() 공개 메소드

Executes request to Pinterest API.
public exec ( string $resourceUrl, string $postString = '' ) : string
$resourceUrl string
$postString string
리턴 string

getContentTypeHeader() 보호된 메소드

If we are uploading file, we should build boundary form data. Otherwise it is simple urlencoded form.
protected getContentTypeHeader ( ) : array
리턴 array

getDefaultHttpHeaders() 보호된 메소드

protected getDefaultHttpHeaders ( ) : array
리턴 array

getHttpClient() 공개 메소드

public getHttpClient ( ) : seregazhuk\PinterestBot\Api\Contracts\HttpClient
리턴 seregazhuk\PinterestBot\Api\Contracts\HttpClient

getHttpHeaders() 보호된 메소드

protected getHttpHeaders ( ) : array
리턴 array

getLastError() 공개 메소드

public getLastError ( ) : array | null
리턴 array | null

isLoggedIn() 공개 메소드

Get current auth status.
public isLoggedIn ( ) : boolean
리턴 boolean

login() 공개 메소드

Mark client as logged.
public login ( )

logout() 공개 메소드

Mark client as logged out.
public logout ( )

makeHeadersForUpload() 보호된 메소드

protected makeHeadersForUpload ( ) : array
리턴 array

setTokenFromCookies() 공개 메소드

Trying to get csrf token from cookies.
public setTokenFromCookies ( )

upload() 공개 메소드

public upload ( string $pathToFile, string $url ) : string
$pathToFile string
$url string
리턴 string

프로퍼티 상세

$csrfToken 보호되어 있는 프로퍼티

protected string $csrfToken
리턴 string

$filePathToUpload 보호되어 있는 프로퍼티

protected string $filePathToUpload
리턴 string

$httpClient 보호되어 있는 프로퍼티

protected HttpClient,seregazhuk\PinterestBot\Api\Contracts $httpClient
리턴 seregazhuk\PinterestBot\Api\Contracts\HttpClient

$lastError 보호되어 있는 프로퍼티

protected array|null $lastError
리턴 array | null

$loggedIn 보호되어 있는 프로퍼티

protected bool $loggedIn
리턴 boolean

$postFileData 보호되어 있는 프로퍼티

protected string $postFileData
리턴 string

$requestHeaders 보호되어 있는 프로퍼티

Common headers needed for every query.
protected array $requestHeaders
리턴 array