Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class Client
*/
public function __construct($accountId, $applicationKey, array $options = [])
{

$this->accountId = $accountId;
$this->applicationKey = $applicationKey;

Expand All @@ -34,8 +35,15 @@ public function __construct($accountId, $applicationKey, array $options = [])
} else {
$this->client = new HttpClient(['exceptions' => false]);
}

if(!empty($options['authorization'])){
$this->authToken = $options['authorization']['authToken'];
$this->apiUrl = $options['authorization']['apiUrl'];
$this->downloadUrl = $options['authorization']['downloadUrl'];
} else {
$this->authorizeAccount();
}

$this->authorizeAccount();
}

/**
Expand Down Expand Up @@ -399,6 +407,22 @@ public function deleteFile(array $options)

return true;
}

/**
* Retrieve authorization details from connection
*
* @return array
*/
public function getAuthorization()
{

return [
'authToken' => $this->authToken,
'apiUrl' => $this->apiUrl,
'downloadUrl' => $this->downloadUrl
];

}

/**
* Authorize the B2 account in order to get an auth token and API/download URLs.
Expand Down