cobiyu/hiworks-oauth-sdk

Hiworks Oauth SDK for PHP

0.3.0 2019-06-14 02:06 UTC

This package is auto-updated.

Last update: 2024-05-17 11:42:22 UTC


README

Build Status Latest Stable Version License

Hiworks Oauth v2 PHP 연동 모듈

Install

composer require cobiyu/hiworks-oauth-sdk

Usage

Note: Note: This version of this SDK for PHP requires PHP 5.6 or greater.

Doc Link: https://documenter.getpostman.com/view/6863253/S1TVWcri?version=latest#intro

Generate Hiworks SDK instance

$client = new \Hiworks\Hiworks($app_client_id,$app_password);

Get Access Token using Authorization Code

$client = new \Hiworks\Hiworks($app_client_id,$app_password);

// getAccessToken return Hiworks\Auth\AccessToken instance.
// $auth_code is received parameter(name:auth_code) in your app's callback.
$access_token = $client->getAccessToken->getAccessToken($auth_code);

echo $access_token->getAccessToken();   // print access_toekn (example. fh283nfdsialvcxzvclxzvcxz)

Get Hiworks API response using access token

// $path and $access token must be string.
// api result is object.
$get_response = $client->get($path, $access_token)
$post_response = $client->post($path, $access_token)
$put_response = $client->put($path, $access_token)
$delete_response = $client->delete($path, $access_token)

Exception

Hiworks\Exceptions\HiworksSDKException : package의 최상위 Exception

자세한 exception 내용이 필요하다면 , Hiworks\Exceptions 참조

catch(HiworksSDKException $e)
{
    /// some logic
}