Skip to content
Merged
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
16 changes: 8 additions & 8 deletions src/LinkedinShare.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ private function uploadImage($url, $access_token, $image)
);
}

public function shareImage($code, $image, $text)
public function shareImage($code, $image, $text, $access_type = 'code')
{
$client = new Client();
$access_token = $this->getAccessToken($code);
$access_token = ($access_type === 'code') ? $this->getAccessToken($code) : $code;
$personURN = $this->getProfile($access_token)['id'];
$uploadObject = $this->registerUpload($access_token, $personURN);
$asset = $uploadObject['value']['asset'];
Expand Down Expand Up @@ -142,11 +142,11 @@ public function shareImage($code, $image, $text)

}

public function shareArticle($code, $url, $text)
public function shareArticle($code, $url, $text, $access_type = 'code')
{
$client = new Client();
$access_token = $this->getAccessToken($code);
$personURN = $this->getProfile($access_token)['id'];
$access_token = ($access_type === 'code') ? $this->getAccessToken($code) : $code;
$personURN = $this->getProfile($access_token)['id'];


$client->request('POST', 'https://api.linkedin.com/v2/ugcPosts', [
Expand Down Expand Up @@ -182,11 +182,11 @@ public function shareArticle($code, $url, $text)

}

public function shareNone($code, $text)
public function shareNone($code, $text, $access_type = 'code')
{
$client = new Client();
$access_token = $this->getAccessToken($code);
$personURN = $this->getProfile($access_token)['id'];
$access_token = ($access_type === 'code') ? $this->getAccessToken($code) : $code;
$personURN = $this->getProfile($access_token)['id'];


$client->request('POST', 'https://api.linkedin.com/v2/ugcPosts', [
Expand Down