Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/pouu69/kakao-api
Browse files Browse the repository at this point in the history
  • Loading branch information
pouu69 committed Nov 23, 2016
2 parents 4afaebb + 8129d8b commit e247bf9
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 3 deletions.
16 changes: 14 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ composer require pouu69/kakao-api

```` php
'providers' => [
pouu69\KakaoApi\KakaoApiServiceProvider::class,
pouu69\KakaoApi\KakaoServiceProvider::class,
]
````

Expand All @@ -42,7 +42,7 @@ Facade 등록을 통해 alias를 등록 하는 경우 다음과 같이 추가

```` php
'aliases' => [
'Kakao' => pouu69\KakaoApi\KakaoApiFacade::class,
'Kakao' => pouu69\KakaoApi\Facade\KakaoFacade::class,
];
````

Expand Down Expand Up @@ -79,6 +79,7 @@ return [
- 사용자 정보 요청
- 카카오 스토리 API
- 사용자 확인
- 글 포스팅(only 글)
- 사진(photo) 포스팅
- 사진 업로드
- 퍼블리싱(포스팅)
Expand Down Expand Up @@ -175,6 +176,17 @@ if(session()->has('kakao_access_token') && session()->has('kakao_refresh_token')
// error handling
}
````
##카카오 스토리 API - 글 포스팅(only 글)
- 오로지 글만 포스팅 합니다.

```` php
try{
$content = '이것이 내용입니다.';
$result = Kakao::postNote($content, session()->get('kakao_access_token'));
}catch(\Exception $e){
var_dump($e->getMessage());
}
````

##카카오 스토리 API - 사진 포스팅
### 사진 업로드
Expand Down
24 changes: 23 additions & 1 deletion src/Traits/KakaoStoryTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,30 @@ public function isStoryUser($accessToken){
return $this->get($this->API_TYPE, $requestAPI, $options);
}

public function postNote(){
/**
* 글 포스팅
* @param string $content 내용
* @param string $accessToken 사용자 엑새스 토큰
* @return array response
*/
public function postNote($content, $accessToken){
$requestAPI = $this->API_VERSION.'/api/story/post/note';

$header = [
'Content-Type' => "application/x-www-form-urlencoded;charset=utf-8",
'Authorization' => "Bearer {$accessToken}"
];

$data = [
'content' => $content
];

$options = [
'headers' => $header,
'form_params' => $data
];

return $this->post($this->API_TYPE, $requestAPI, $options);
}

/**
Expand Down

0 comments on commit e247bf9

Please sign in to comment.