├── .docgen ├── .github └── workflows │ └── build.yml ├── .gitignore ├── .tests ├── CHANGES.md ├── LICENSE ├── README.md ├── TODO.md ├── composer.json ├── docs └── docs.zip ├── example ├── console-own-auth-lib.php ├── console.php └── web.php ├── phpunit.xml ├── src └── Upwork │ └── API │ ├── ApiException.php │ ├── AuthTypes │ ├── AbstractOAuth.php │ ├── OAuth1.php │ └── OAuthPHPLib.php │ ├── Client.php │ ├── Config.php │ ├── Debug.php │ ├── Interfaces │ └── Client.php │ ├── Routers │ ├── Activities │ │ ├── Engagement.php │ │ └── Team.php │ ├── Auth.php │ ├── Freelancers │ │ ├── Profile.php │ │ └── Search.php │ ├── Hr │ │ ├── Clients │ │ │ ├── Applications.php │ │ │ └── Offers.php │ │ ├── Contracts.php │ │ ├── Engagements.php │ │ ├── Freelancers │ │ │ ├── Applications.php │ │ │ └── Offers.php │ │ ├── Interviews.php │ │ ├── Jobs.php │ │ ├── Milestones.php │ │ ├── Roles.php │ │ └── Submissions.php │ ├── Jobs │ │ ├── Profile.php │ │ └── Search.php │ ├── Messages.php │ ├── Metadata.php │ ├── Organization │ │ ├── Companies.php │ │ ├── Teams.php │ │ └── Users.php │ ├── Payments.php │ ├── Reports │ │ ├── Finance │ │ │ ├── Accounts.php │ │ │ ├── Billings.php │ │ │ └── Earnings.php │ │ └── Time.php │ ├── Snapshot.php │ ├── Workdays.php │ └── Workdiary.php │ ├── Utils.php │ └── constants.php ├── tests └── Upwork │ └── API │ ├── ApiExceptionTest.php │ ├── AuthTypes │ └── AbstractOAuthTest.php │ ├── ClientTest.php │ ├── ConfigTest.php │ ├── DebugTest.php │ ├── Interfaces │ └── ClientTest.php │ ├── Routers │ ├── Activities │ │ ├── EngagementTest.php │ │ └── TeamTest.php │ ├── AuthTest.php │ ├── CommonTestRouter.php │ ├── Freelancers │ │ ├── ProfileTest.php │ │ └── SearchTest.php │ ├── Hr │ │ ├── Clients │ │ │ ├── ApplicationsTest.php │ │ │ └── OffersTest.php │ │ ├── ContractsTest.php │ │ ├── EngagementsTest.php │ │ ├── Freelancers │ │ │ ├── ApplicationsTest.php │ │ │ └── OffersTest.php │ │ ├── InterviewsTest.php │ │ ├── JobsTest.php │ │ ├── MilestonesTest.php │ │ ├── RolesTest.php │ │ └── SubmissionsTest.php │ ├── Jobs │ │ ├── ProfileTest.php │ │ └── SearchTest.php │ ├── MessagesTest.php │ ├── MetadataTest.php │ ├── Organization │ │ ├── CompaniesTest.php │ │ ├── TeamsTest.php │ │ └── UsersTest.php │ ├── PaymentsTest.php │ ├── Reports │ │ ├── Finance │ │ │ ├── AccountsTest.php │ │ │ ├── BillingsTest.php │ │ │ └── EarningsTest.php │ │ └── TimeTest.php │ ├── SnapshotTest.php │ ├── WorkdaysTest.php │ └── WorkdiaryTest.php │ └── UtilsTest.php └── vendor-src ├── README └── oauth-php ├── LICENSE ├── README ├── example ├── client │ ├── googledocs.php │ ├── twolegged.php │ ├── twoleggedtest.php │ └── twoleggedtwitter.php └── server │ ├── INSTALL │ ├── core │ ├── init.php │ └── templates │ │ ├── inc │ │ ├── footer.tpl │ │ └── header.tpl │ │ ├── index.tpl │ │ ├── logon.tpl │ │ └── register.tpl │ └── www │ ├── hello.php │ ├── index.php │ ├── logon.php │ ├── oauth.php │ ├── register.php │ └── services.xrds.php ├── library ├── OAuthDiscovery.php ├── OAuthException2.php ├── OAuthRequest.php ├── OAuthRequestLogger.php ├── OAuthRequestSigner.php ├── OAuthRequestVerifier.php ├── OAuthRequester.php ├── OAuthServer.php ├── OAuthSession.php ├── OAuthStore.php ├── body │ ├── OAuthBodyContentDisposition.php │ └── OAuthBodyMultipartFormdata.php ├── discovery │ ├── xrds_parse.php │ └── xrds_parse.txt ├── session │ ├── OAuthSessionAbstract.class.php │ └── OAuthSessionSESSION.php ├── signature_method │ ├── OAuthSignatureMethod.class.php │ ├── OAuthSignatureMethod_HMAC_SHA1.php │ ├── OAuthSignatureMethod_MD5.php │ ├── OAuthSignatureMethod_PLAINTEXT.php │ └── OAuthSignatureMethod_RSA_SHA1.php └── store │ ├── OAuthStore2Leg.php │ ├── OAuthStoreAbstract.class.php │ ├── OAuthStoreAnyMeta.php │ ├── OAuthStoreMySQL.php │ ├── OAuthStoreMySQLi.php │ ├── OAuthStoreOracle.php │ ├── OAuthStorePDO.php │ ├── OAuthStorePostgreSQL.php │ ├── OAuthStoreSQL.php │ ├── OAuthStoreSession.php │ ├── mysql │ ├── install.php │ └── mysql.sql │ ├── oracle │ ├── OracleDB │ │ ├── 1_Tables │ │ │ └── TABLES.sql │ │ ├── 2_Sequences │ │ │ └── SEQUENCES.sql │ │ └── 3_Procedures │ │ │ ├── SP_ADD_CONSUMER_REQUEST_TOKEN.prc │ │ │ ├── SP_ADD_LOG.prc │ │ │ ├── SP_ADD_SERVER_TOKEN.prc │ │ │ ├── SP_AUTH_CONSUMER_REQ_TOKEN.prc │ │ │ ├── SP_CHECK_SERVER_NONCE.prc │ │ │ ├── SP_CONSUMER_STATIC_SAVE.prc │ │ │ ├── SP_COUNT_CONSUMER_ACCESS_TOKEN.prc │ │ │ ├── SP_COUNT_SERVICE_TOKENS.prc │ │ │ ├── SP_DELETE_CONSUMER.prc │ │ │ ├── SP_DELETE_SERVER.prc │ │ │ ├── SP_DELETE_SERVER_TOKEN.prc │ │ │ ├── SP_DEL_CONSUMER_ACCESS_TOKEN.prc │ │ │ ├── SP_DEL_CONSUMER_REQUEST_TOKEN.prc │ │ │ ├── SP_EXCH_CONS_REQ_FOR_ACC_TOKEN.prc │ │ │ ├── SP_GET_CONSUMER.prc │ │ │ ├── SP_GET_CONSUMER_ACCESS_TOKEN.prc │ │ │ ├── SP_GET_CONSUMER_REQUEST_TOKEN.prc │ │ │ ├── SP_GET_CONSUMER_STATIC_SELECT.prc │ │ │ ├── SP_GET_SECRETS_FOR_SIGNATURE.prc │ │ │ ├── SP_GET_SECRETS_FOR_VERIFY.prc │ │ │ ├── SP_GET_SERVER.prc │ │ │ ├── SP_GET_SERVER_FOR_URI.prc │ │ │ ├── SP_GET_SERVER_TOKEN.prc │ │ │ ├── SP_GET_SERVER_TOKEN_SECRETS.prc │ │ │ ├── SP_LIST_CONSUMERS.prc │ │ │ ├── SP_LIST_CONSUMER_TOKENS.prc │ │ │ ├── SP_LIST_LOG.prc │ │ │ ├── SP_LIST_SERVERS.prc │ │ │ ├── SP_LIST_SERVER_TOKENS.prc │ │ │ ├── SP_SET_CONSUMER_ACC_TOKEN_TTL.prc │ │ │ ├── SP_SET_SERVER_TOKEN_TTL.prc │ │ │ ├── SP_UPDATE_CONSUMER.prc │ │ │ └── SP_UPDATE_SERVER.prc │ └── install.php │ └── postgresql │ └── pgsql.sql └── test ├── discovery ├── xrds-fireeagle.xrds ├── xrds-getsatisfaction.xrds └── xrds-magnolia.xrds └── oauth_test.php /.docgen: -------------------------------------------------------------------------------- 1 | apigen generate -s src/ -d docs_html 2 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: build 2 | 3 | on: 4 | push: 5 | paths-ignore: 6 | - '**.md' 7 | pull_request: 8 | paths-ignore: 9 | - '**.md' 10 | 11 | jobs: 12 | test: 13 | 14 | runs-on: ${{ matrix.os }} 15 | strategy: 16 | fail-fast: false 17 | matrix: 18 | os: [ubuntu-latest] 19 | php: [ '7.3', '7.4' ] 20 | 21 | name: PHP ${{ matrix.python }} 22 | steps: 23 | - uses: actions/checkout@v2 24 | - name: Setup PHP with tools 25 | uses: shivammathur/setup-php@v2 26 | with: 27 | php-version: ${{ matrix.php }} 28 | - name: Setup PHP/composer 29 | uses: php-actions/composer@v6 30 | with: 31 | php_version: ${{ matrix.php }} 32 | version: 2 33 | - name: Run tests 34 | run: ./vendor/phpunit/phpunit/phpunit --stderr 35 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /vendor 2 | *~ 3 | composer.lock 4 | -------------------------------------------------------------------------------- /.tests: -------------------------------------------------------------------------------- 1 | ./vendor/phpunit/phpunit/phpunit.php --stderr 2 | -------------------------------------------------------------------------------- /TODO.md: -------------------------------------------------------------------------------- 1 | # TODO List 2 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "upwork/php-upwork", 3 | "description": "PHP bindings for Upwork API", 4 | "version": "v1.4.0", 5 | "type": "library", 6 | "keywords": ["upwork", "php", "api"], 7 | "homepage": "http://www.upwork.com", 8 | "time": "2020-09-09", 9 | "license": "Apache-2.0", 10 | "authors": [ 11 | { 12 | "name": "Maksym Novozhylov", 13 | "email": "mnovozhilov@upwork.com", 14 | "homepage": "http://mnov.tel", 15 | "role": "Software Engineer, Platform/Integrity" 16 | } 17 | ], 18 | "support": { 19 | "email": "apisupport@upwork.com", 20 | "issues": "https://github.com/upwork/php-upwork/issues", 21 | "forum": "https://www.upwork.com/community/forum/49", 22 | "source": "https://github.com/upwork/php-upwork/releases", 23 | "wiki": "http://developers.upwork.com" 24 | }, 25 | "suggest": { 26 | "ext-oauth": "This extension from PECL provides OAuth consumer and provider bindings. See more under http://www.php.net/oauth", 27 | "apigen/apigen": "dev-master", 28 | "roave/better-reflection": "dev-master" 29 | }, 30 | "require": { 31 | "php": ">=5.3.3", 32 | "ext-json": "*" 33 | }, 34 | "require-dev": { 35 | "phpunit/phpunit": "^9", 36 | "phpunit/php-invoker": "*" 37 | }, 38 | "autoload": { 39 | "psr-0": { 40 | "Upwork\\API": "src/" 41 | }, 42 | "files": [ 43 | "src/Upwork/API/constants.php" 44 | ] 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /docs/docs.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upwork/php-upwork/f496104b46e44dd19a2cc4da2c9a522dae6ed04d/docs/docs.zip -------------------------------------------------------------------------------- /example/console-own-auth-lib.php: -------------------------------------------------------------------------------- 1 | 11 | * @license Upwork's API Terms of Use {@link https://developers.upwork.com/api-tos.html} 12 | */ 13 | 14 | // Our php-oauth library - used in this example - requires a session 15 | session_start(); 16 | 17 | require __DIR__ . '/vendor/autoload.php'; 18 | 19 | // if you already have the tokens, they can be read from session 20 | // or other secure storage 21 | //$_SESSION['access_token'] = 'xxxxxxxxxxxxxxxxxxxxxxxxxxx'; 22 | //$_SESSION['access_secret']= 'xxxxxxxxxxxx'; 23 | 24 | $config = new \Upwork\API\Config( 25 | array( 26 | 'consumerKey' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxx', // SETUP YOUR CONSUMER KEY 27 | 'consumerSecret' => 'xxxxxxxxxxxx', // SETUP KEY SECRET 28 | 'accessToken' => $_SESSION['access_token'], // got access token 29 | 'accessSecret' => $_SESSION['access_secret'], // got access secret 30 | // 'verifySsl' => false, // whether to verify SSL 31 | 'debug' => true, // enables debug mode 32 | 'authType' => 'OAuthPHPLib' // your own authentication type, see AuthTypes directory 33 | ) 34 | ); 35 | 36 | $client = new \Upwork\API\Client($config); 37 | 38 | // our example AuthType allows assigning already known token data 39 | if (!empty($_SESSION['access_token']) && !empty($_SESSION['access_secret'])) { 40 | $client->getServer() 41 | ->getInstance() 42 | ->addServerToken( 43 | $config::get('consumerKey'), 44 | 'access', 45 | $_SESSION['access_token'], 46 | $_SESSION['access_secret'], 47 | 0 48 | ); 49 | } else { 50 | // $accessTokenInfo has the following structure 51 | // array('access_token' => ..., 'access_secret' => ...); 52 | // keeps the access token in a secure place 53 | // gets info of authenticated user 54 | $accessTokenInfo = $client->auth(); 55 | } 56 | 57 | $auth = new \Upwork\API\Routers\Auth($client); 58 | $info = $auth->getUserInfo(); 59 | 60 | print_r($info); 61 | -------------------------------------------------------------------------------- /example/console.php: -------------------------------------------------------------------------------- 1 | 10 | * @license Upwork's API Terms of Use {@link https://developers.upwork.com/api-tos.html} 11 | */ 12 | 13 | require __DIR__ . '/vendor/autoload.php'; 14 | 15 | // if you already have the tokens, they can be read from session 16 | // or other secure storage 17 | //$_SESSION['access_token'] = 'xxxxxxxxxxxxxxxxxxxxxxxxxxx'; 18 | //$_SESSION['access_secret']= 'xxxxxxxxxxxx'; 19 | 20 | $config = new \Upwork\API\Config( 21 | array( 22 | 'consumerKey' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxx', // SETUP YOUR CONSUMER KEY 23 | 'consumerSecret' => 'xxxxxxxxxxxxxx', // SETUP KEY SECRET 24 | 'accessToken' => $_SESSION['access_token'], // got access token 25 | 'accessSecret' => $_SESSION['access_secret'], // got access secret 26 | 'debug' => true, // enables debug mode 27 | // 'authType' => 'MyOAuth' // your own authentication type, see AuthTypes directory 28 | ) 29 | ); 30 | 31 | $client = new \Upwork\API\Client($config); 32 | 33 | $accessTokenInfo = $client->auth(); 34 | // $accessTokenInfo has the following structure 35 | // array('access_token' => ..., 'access_secret' => ...); 36 | // keeps the access token in a secure place 37 | 38 | // gets info of the authenticated user 39 | $auth = new \Upwork\API\Routers\Auth($client); 40 | $info = $auth->getUserInfo(); 41 | 42 | print_r($info); 43 | -------------------------------------------------------------------------------- /example/web.php: -------------------------------------------------------------------------------- 1 | 10 | * @license Upwork's API Terms of Use {@link https://developers.upwork.com/api-tos.html} 11 | */ 12 | session_start(); 13 | 14 | require __DIR__ . '/vendor/autoload.php'; 15 | 16 | $config = new \Upwork\API\Config( 17 | array( 18 | 'consumerKey' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxx', // SETUP YOUR CONSUMER KEY 19 | 'consumerSecret' => 'xxxxxxxxxxxxx', // SETUP YOUR KEY SECRET 20 | 'accessToken' => $_SESSION['access_token'], // got access token 21 | 'accessSecret' => $_SESSION['access_secret'], // got access secret 22 | 'requestToken' => $_SESSION['request_token'], // got request token 23 | 'requestSecret' => $_SESSION['request_secret'], // got request secret 24 | 'verifier' => $_GET['oauth_verifier'], // got oauth verifier after authorization 25 | 'mode' => 'web', // can be 'nonweb' for console apps (default), 26 | // and 'web' for web-based apps 27 | // 'debug' => true, // enables debug mode. Note that enabling debug in web-based applications can block redirects 28 | // 'authType' => 'MyOAuth' // your own authentication type, see AuthTypes directory 29 | ) 30 | ); 31 | 32 | $client = new \Upwork\API\Client($config); 33 | 34 | if (empty($_SESSION['request_token']) && empty($_SESSION['access_token'])) { 35 | // we need to get and save the request token. It will be used again 36 | // after the redirect from the Upwork site 37 | $requestTokenInfo = $client->getRequestToken(); 38 | 39 | $_SESSION['request_token'] = $requestTokenInfo['oauth_token']; 40 | $_SESSION['request_secret'] = $requestTokenInfo['oauth_token_secret']; 41 | // request authorization 42 | $client->auth(); 43 | } elseif (empty($_SESSION['access_token'])) { 44 | // the callback request should be pointed to this script as well as 45 | // the request access token after the callback 46 | $accessTokenInfo = $client->auth(); 47 | 48 | $_SESSION['access_token'] = $accessTokenInfo['access_token']; 49 | $_SESSION['access_secret'] = $accessTokenInfo['access_secret']; 50 | } 51 | // $accessTokenInfo has the following structure 52 | // array('access_token' => ..., 'access_secret' => ...); 53 | // keeps the access token in a secure place 54 | 55 | // if authenticated 56 | if ($_SESSION['access_token']) { 57 | // clean up session data 58 | unset($_SESSION['request_token']); 59 | unset($_SESSION['request_secret']); 60 | 61 | // gets info of the authenticated user 62 | $auth = new \Upwork\API\Routers\Auth($client); 63 | $info = $auth->getUserInfo(); 64 | 65 | print_r($info); 66 | } 67 | -------------------------------------------------------------------------------- /phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | tests 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/Upwork/API/ApiException.php: -------------------------------------------------------------------------------- 1 | 10 | * @license Upwork's API Terms of Use {@link https://developers.upwork.com/api-tos.html} 11 | */ 12 | 13 | namespace Upwork\API; 14 | 15 | /** 16 | * ApiException 17 | */ 18 | final class ApiException extends \Exception 19 | { 20 | } 21 | -------------------------------------------------------------------------------- /src/Upwork/API/Debug.php: -------------------------------------------------------------------------------- 1 | 10 | * @license Upwork's API Terms of Use {@link https://developers.upwork.com/api-tos.html} 11 | */ 12 | 13 | namespace Upwork\API; 14 | 15 | use Upwork\API\Config as ApiConfig; 16 | 17 | /** 18 | * Debug class 19 | */ 20 | class Debug 21 | { 22 | /** 23 | * @var Debug status 24 | */ 25 | static private $_debug = false; 26 | 27 | /** 28 | * Print debug message 29 | * 30 | * @param string $str Debug message 31 | * @param array $args (Optional) Value to dump 32 | * @static 33 | * @access public 34 | * @return void 35 | */ 36 | public static function p($str, $args = false) 37 | { 38 | if (self::$_debug === true || ApiConfig::get('debug') === true) { 39 | // first call 40 | if (self::$_debug === false) { 41 | self::$_debug = true; 42 | } 43 | 44 | if ($args !== false) { 45 | $str .= ', dump: ' . var_export($args, true); 46 | } 47 | 48 | $str .= ".\n"; 49 | 50 | print_r('> ' . $str); 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/Upwork/API/Interfaces/Client.php: -------------------------------------------------------------------------------- 1 | 10 | * @license Upwork's API Terms of Use {@link https://developers.upwork.com/api-tos.html} 11 | */ 12 | 13 | namespace Upwork\API\Interfaces; 14 | 15 | /** 16 | * Client Interface for AuthTypes 17 | */ 18 | interface Client 19 | { 20 | /** 21 | * Authentication 22 | * 23 | * @access public 24 | */ 25 | public function auth(); 26 | 27 | /** 28 | * Request to API server 29 | * 30 | * @param string $type Type of request, i.e. http method 31 | * @param string $url URL 32 | * @param array $params (Optional) List of additional parameters 33 | * @access public 34 | */ 35 | public function request($type, $url, $params = array()); 36 | 37 | /** 38 | * Request token from server, i.e. setup it on server and return to client 39 | * 40 | * @access public 41 | */ 42 | public function setupRequestToken(); 43 | } 44 | -------------------------------------------------------------------------------- /src/Upwork/API/Routers/Activities/Engagement.php: -------------------------------------------------------------------------------- 1 | 11 | * @license Upwork's API Terms of Use {@link https://developers.upwork.com/api-tos.html} 12 | */ 13 | 14 | namespace Upwork\API\Routers\Activities; 15 | 16 | use Upwork\API\Debug as ApiDebug; 17 | use Upwork\API\Client as ApiClient; 18 | 19 | /** 20 | * Get an Activity records by contract/engagement 21 | * 22 | * @link http://developers.upwork.com/oTasks-API 23 | */ 24 | final class Engagement extends ApiClient 25 | { 26 | const ENTRY_POINT = UPWORK_API_EP_NAME; 27 | 28 | /** 29 | * @var Client instance 30 | */ 31 | private $_client; 32 | 33 | /** 34 | * Constructor 35 | * 36 | * @param ApiClient $client Client object 37 | */ 38 | public function __construct(ApiClient $client) 39 | { 40 | ApiDebug::p('init ' . __CLASS__ . ' router'); 41 | $this->_client = $client; 42 | parent::$_epoint = self::ENTRY_POINT; 43 | } 44 | 45 | /** 46 | * List activities for specific engagement 47 | * 48 | * @param integer $engagementRef Engagement reference 49 | * @return object 50 | */ 51 | public function getSpecific($engagementRef) 52 | { 53 | ApiDebug::p(__FUNCTION__); 54 | 55 | $response = $this->_client->get('/tasks/v2/tasks/contracts/' . $engagementRef); 56 | ApiDebug::p('found response info', $response); 57 | 58 | return $response; 59 | } 60 | 61 | /** 62 | * Assign engagements to the list of activities 63 | * 64 | * @param string $company Company ID 65 | * @param string $team Team ID 66 | * @param integer $engagement Engagement 67 | * @param array $params Parameters 68 | * @return object 69 | */ 70 | public function assign($company, $team, $engagement, $params) 71 | { 72 | ApiDebug::p(__FUNCTION__); 73 | 74 | $response = $this->_client->put('/otask/v1/tasks/companies/' .$company . '/teams/' . $team . '/engagements/' . $engagement . '/tasks', $params); 75 | ApiDebug::p('found response info', $response); 76 | 77 | return $response; 78 | } 79 | 80 | /** 81 | * Assign to specific engagement the list of activities 82 | * 83 | * @param integer $engagement Engagement 84 | * @param array $params Parameters 85 | * @return object 86 | */ 87 | public function assignToEngagement($engagement, $params) 88 | { 89 | ApiDebug::p(__FUNCTION__); 90 | 91 | $response = $this->_client->put('/tasks/v2/tasks/contracts/' . $engagement, $params); 92 | ApiDebug::p('found response info', $response); 93 | 94 | return $response; 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /src/Upwork/API/Routers/Auth.php: -------------------------------------------------------------------------------- 1 | 11 | * @license Upwork's API Terms of Use {@link https://developers.upwork.com/api-tos.html} 12 | */ 13 | 14 | namespace Upwork\API\Routers; 15 | 16 | use Upwork\API\Debug as ApiDebug; 17 | use Upwork\API\Client as ApiClient; 18 | 19 | /** 20 | * My Info 21 | * 22 | * @link http://developers.upwork.com/My%20Info 23 | */ 24 | final class Auth extends ApiClient 25 | { 26 | const ENTRY_POINT = UPWORK_API_EP_NAME; 27 | 28 | /** 29 | * @var Client instance 30 | */ 31 | private $_client; 32 | 33 | /** 34 | * Constructor 35 | * 36 | * @param ApiClient $client Client object 37 | */ 38 | public function __construct(ApiClient $client) 39 | { 40 | ApiDebug::p('init ' . __CLASS__ . ' router'); 41 | $this->_client = $client; 42 | parent::$_epoint = self::ENTRY_POINT; 43 | } 44 | 45 | /** 46 | * My Info 47 | * 48 | * @return object 49 | */ 50 | public function getUserInfo() 51 | { 52 | ApiDebug::p(__FUNCTION__); 53 | 54 | $info = $this->_client->get('/auth/v1/info'); 55 | ApiDebug::p('found auth info', $info); 56 | 57 | return $info; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/Upwork/API/Routers/Freelancers/Profile.php: -------------------------------------------------------------------------------- 1 | 11 | * @license Upwork's API Terms of Use {@link https://developers.upwork.com/api-tos.html} 12 | */ 13 | 14 | namespace Upwork\API\Routers\Freelancers; 15 | 16 | use Upwork\API\Debug as ApiDebug; 17 | use Upwork\API\Client as ApiClient; 18 | 19 | /** 20 | * Freelancer Profile 21 | * 22 | * @link http://developers.upwork.com/Freelancer-Profile 23 | */ 24 | final class Profile extends ApiClient 25 | { 26 | const ENTRY_POINT = UPWORK_API_EP_NAME; 27 | 28 | /** 29 | * @var Client instance 30 | */ 31 | private $_client; 32 | 33 | /** 34 | * Constructor 35 | * 36 | * @param ApiClient $client Client object 37 | */ 38 | public function __construct(ApiClient $client) 39 | { 40 | ApiDebug::p('init ' . __CLASS__ . ' router'); 41 | $this->_client = $client; 42 | parent::$_epoint = self::ENTRY_POINT; 43 | } 44 | 45 | /** 46 | * Get specific Freelancer Profile 47 | * 48 | * @param string $key Profile key 49 | * @return object 50 | */ 51 | public function getSpecific($key) 52 | { 53 | ApiDebug::p(__FUNCTION__); 54 | 55 | $response = $this->_client->get('/profiles/v1/providers/' . $key); 56 | ApiDebug::p('found response info', $response); 57 | 58 | return $response; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/Upwork/API/Routers/Freelancers/Search.php: -------------------------------------------------------------------------------- 1 | 11 | * @license Upwork's API Terms of Use {@link https://developers.upwork.com/api-tos.html} 12 | */ 13 | 14 | namespace Upwork\API\Routers\Freelancers; 15 | 16 | use Upwork\API\Debug as ApiDebug; 17 | use Upwork\API\Client as ApiClient; 18 | 19 | /** 20 | * Search Freelancers 21 | * 22 | * @link http://developers.upwork.com/search-providers 23 | */ 24 | final class Search extends ApiClient 25 | { 26 | const ENTRY_POINT = UPWORK_API_EP_NAME; 27 | 28 | /** 29 | * @var Client instance 30 | */ 31 | private $_client; 32 | 33 | /** 34 | * Constructor 35 | * 36 | * @param ApiClient $client Client object 37 | */ 38 | public function __construct(ApiClient $client) 39 | { 40 | ApiDebug::p('init ' . __CLASS__ . ' router'); 41 | $this->_client = $client; 42 | parent::$_epoint = self::ENTRY_POINT; 43 | } 44 | 45 | /** 46 | * Search freelancers 47 | * 48 | * @param array $params (Optional) Parameters 49 | * @return object 50 | */ 51 | public function find($params = array()) 52 | { 53 | ApiDebug::p(__FUNCTION__); 54 | 55 | $response = $this->_client->get('/profiles/v2/search/providers', $params); 56 | ApiDebug::p('found response info', $response); 57 | 58 | return $response; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/Upwork/API/Routers/Hr/Clients/Applications.php: -------------------------------------------------------------------------------- 1 | 11 | * @license Upwork's API Terms of Use {@link https://developers.upwork.com/api-tos.html} 12 | */ 13 | 14 | namespace Upwork\API\Routers\Hr\Clients; 15 | 16 | use Upwork\API\Debug as ApiDebug; 17 | use Upwork\API\Client as ApiClient; 18 | 19 | /** 20 | * Client Job Applications API 21 | * 22 | * @link http://developers.upwork.com/w/page/75436187/Client%20Job%20Applications 23 | */ 24 | final class Applications extends ApiClient 25 | { 26 | const ENTRY_POINT = UPWORK_API_EP_NAME; 27 | 28 | /** 29 | * @var Client instance 30 | */ 31 | private $_client; 32 | 33 | /** 34 | * Constructor 35 | * 36 | * @param ApiClient $client Client object 37 | */ 38 | public function __construct(ApiClient $client) 39 | { 40 | ApiDebug::p('init ' . __CLASS__ . ' router'); 41 | $this->_client = $client; 42 | parent::$_epoint = self::ENTRY_POINT; 43 | } 44 | 45 | /** 46 | * Get list of applications 47 | * 48 | * @param array $params Parameters 49 | * @return object 50 | */ 51 | public function getList($params) 52 | { 53 | ApiDebug::p(__FUNCTION__); 54 | 55 | $response = $this->_client->get('/hr/v4/clients/applications', $params); 56 | ApiDebug::p('found response info', $response); 57 | 58 | return $response; 59 | } 60 | 61 | /** 62 | * Get specific application 63 | * 64 | * @param integer $reference Application reference 65 | * @param array $params Parameters 66 | * @return object 67 | */ 68 | public function getSpecific($reference, $params) 69 | { 70 | ApiDebug::p(__FUNCTION__); 71 | 72 | $response = $this->_client->get('/hr/v4/clients/applications/' . $reference, $params); 73 | ApiDebug::p('found response info', $response); 74 | 75 | return $response; 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /src/Upwork/API/Routers/Hr/Clients/Offers.php: -------------------------------------------------------------------------------- 1 | 11 | * @license Upwork's API Terms of Use {@link https://developers.upwork.com/api-tos.html} 12 | */ 13 | 14 | namespace Upwork\API\Routers\Hr\Clients; 15 | 16 | use Upwork\API\Debug as ApiDebug; 17 | use Upwork\API\Client as ApiClient; 18 | 19 | /** 20 | * Client Job Offers API 21 | * 22 | * @link http://developers.upwork.com/w/page/70447610/Client%20Offers 23 | */ 24 | final class Offers extends ApiClient 25 | { 26 | const ENTRY_POINT = UPWORK_API_EP_NAME; 27 | 28 | /** 29 | * @var Client instance 30 | */ 31 | private $_client; 32 | 33 | /** 34 | * Constructor 35 | * 36 | * @param ApiClient $client Client object 37 | */ 38 | public function __construct(ApiClient $client) 39 | { 40 | ApiDebug::p('init ' . __CLASS__ . ' router'); 41 | $this->_client = $client; 42 | parent::$_epoint = self::ENTRY_POINT; 43 | } 44 | 45 | /** 46 | * Get list of offers 47 | * 48 | * @param array $params Parameters 49 | * @return object 50 | */ 51 | public function getList($params) 52 | { 53 | ApiDebug::p(__FUNCTION__); 54 | 55 | $response = $this->_client->get('/offers/v1/clients/offers', $params); 56 | ApiDebug::p('found response info', $response); 57 | 58 | return $response; 59 | } 60 | 61 | /** 62 | * Get specific offer 63 | * 64 | * @param integer $reference Offer reference 65 | * @param array $params Parameters 66 | * @return object 67 | */ 68 | public function getSpecific($reference, $params) 69 | { 70 | ApiDebug::p(__FUNCTION__); 71 | 72 | $response = $this->_client->get('/offers/v1/clients/offers/' . $reference, $params); 73 | ApiDebug::p('found response info', $response); 74 | 75 | return $response; 76 | } 77 | 78 | /** 79 | * Send offer 80 | * 81 | * @param array $params Parameters 82 | * @return object 83 | */ 84 | public function makeOffer($params) 85 | { 86 | ApiDebug::p(__FUNCTION__); 87 | 88 | $response = $this->_client->post('/offers/v1/clients/offers', $params); 89 | ApiDebug::p('found response info', $response); 90 | 91 | return $response; 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /src/Upwork/API/Routers/Hr/Contracts.php: -------------------------------------------------------------------------------- 1 | 11 | * @license Upwork's API Terms of Use {@link https://developers.upwork.com/api-tos.html} 12 | */ 13 | 14 | namespace Upwork\API\Routers\Hr; 15 | 16 | use Upwork\API\Debug as ApiDebug; 17 | use Upwork\API\Client as ApiClient; 18 | 19 | /** 20 | * Contracts API 21 | * 22 | * @link http://developers.upwork.com/w/page/46842954/Contracts%20API 23 | */ 24 | final class Contracts extends ApiClient 25 | { 26 | const ENTRY_POINT = UPWORK_API_EP_NAME; 27 | 28 | /** 29 | * @var Client instance 30 | */ 31 | private $_client; 32 | 33 | /** 34 | * Constructor 35 | * 36 | * @param ApiClient $client Client object 37 | */ 38 | public function __construct(ApiClient $client) 39 | { 40 | ApiDebug::p('init ' . __CLASS__ . ' router'); 41 | $this->_client = $client; 42 | parent::$_epoint = self::ENTRY_POINT; 43 | } 44 | 45 | /** 46 | * Suspend Contract 47 | * 48 | * @param integer $reference Contract reference 49 | * @param array $params Parameters 50 | * @return object 51 | */ 52 | public function suspendContract($reference, $params) 53 | { 54 | ApiDebug::p(__FUNCTION__); 55 | 56 | $response = $this->_client->put('/hr/v2/contracts/' . $reference . '/suspend', $params); 57 | ApiDebug::p('found response info', $response); 58 | 59 | return $response; 60 | } 61 | 62 | /** 63 | * Restart Contract 64 | * 65 | * @param integer $reference Contract reference 66 | * @param array $params Parameters 67 | * @return object 68 | */ 69 | public function restartContract($reference, $params) 70 | { 71 | ApiDebug::p(__FUNCTION__); 72 | 73 | $response = $this->_client->put('/hr/v2/contracts/' . $reference . '/restart', $params); 74 | ApiDebug::p('found response info', $response); 75 | 76 | return $response; 77 | } 78 | 79 | /** 80 | * End Contract 81 | * 82 | * @param integer $reference Contract reference 83 | * @param array $params Parameters 84 | * @return object 85 | */ 86 | public function endContract($reference, $params) 87 | { 88 | ApiDebug::p(__FUNCTION__); 89 | 90 | $response = $this->_client->delete('/hr/v2/contracts/' . $reference, $params); 91 | ApiDebug::p('found response info', $response); 92 | 93 | return $response; 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /src/Upwork/API/Routers/Hr/Engagements.php: -------------------------------------------------------------------------------- 1 | 11 | * @license Upwork's API Terms of Use {@link https://developers.upwork.com/api-tos.html} 12 | */ 13 | 14 | namespace Upwork\API\Routers\Hr; 15 | 16 | use Upwork\API\Debug as ApiDebug; 17 | use Upwork\API\Client as ApiClient; 18 | 19 | /** 20 | * Engagements API 21 | * 22 | * @link http://developers.upwork.com/Engagements-API 23 | */ 24 | final class Engagements extends ApiClient 25 | { 26 | const ENTRY_POINT = UPWORK_API_EP_NAME; 27 | 28 | /** 29 | * @var Client instance 30 | */ 31 | private $_client; 32 | 33 | /** 34 | * Constructor 35 | * 36 | * @param ApiClient $client Client object 37 | */ 38 | public function __construct(ApiClient $client) 39 | { 40 | ApiDebug::p('init ' . __CLASS__ . ' router'); 41 | $this->_client = $client; 42 | parent::$_epoint = self::ENTRY_POINT; 43 | } 44 | 45 | /** 46 | * Get list of engagements 47 | * 48 | * @param array $params Parameters 49 | * @return object 50 | */ 51 | public function getList($params) 52 | { 53 | ApiDebug::p(__FUNCTION__); 54 | 55 | $engagements = $this->_client->get('/hr/v2/engagements', $params); 56 | ApiDebug::p('found response info', $engagements); 57 | 58 | return $engagements; 59 | } 60 | 61 | /** 62 | * Get specific engagement 63 | * 64 | * @param integer $reference Engagement's reference 65 | * @return object 66 | */ 67 | public function getSpecific($reference) 68 | { 69 | ApiDebug::p(__FUNCTION__); 70 | 71 | $engagement = $this->_client->get('/hr/v2/engagements/' . $reference); 72 | ApiDebug::p('found response info', $engagement); 73 | 74 | return $engagement; 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /src/Upwork/API/Routers/Hr/Freelancers/Applications.php: -------------------------------------------------------------------------------- 1 | 11 | * @license Upwork's API Terms of Use {@link https://developers.upwork.com/api-tos.html} 12 | */ 13 | 14 | namespace Upwork\API\Routers\Hr\Freelancers; 15 | 16 | use Upwork\API\Debug as ApiDebug; 17 | use Upwork\API\Client as ApiClient; 18 | 19 | /** 20 | * Freelancer Job Applications API 21 | * 22 | * @link http://developers.upwork.com/w/page/46842954/Contracts%20API 23 | */ 24 | final class Applications extends ApiClient 25 | { 26 | const ENTRY_POINT = UPWORK_API_EP_NAME; 27 | 28 | /** 29 | * @var Client instance 30 | */ 31 | private $_client; 32 | 33 | /** 34 | * Constructor 35 | * 36 | * @param ApiClient $client Client object 37 | */ 38 | public function __construct(ApiClient $client) 39 | { 40 | ApiDebug::p('init ' . __CLASS__ . ' router'); 41 | $this->_client = $client; 42 | parent::$_epoint = self::ENTRY_POINT; 43 | } 44 | 45 | /** 46 | * Get list of applications 47 | * 48 | * @param array $params Parameters 49 | * @return object 50 | */ 51 | public function getList($params) 52 | { 53 | ApiDebug::p(__FUNCTION__); 54 | 55 | $response = $this->_client->get('/hr/v4/contractors/applications', $params); 56 | ApiDebug::p('found response info', $response); 57 | 58 | return $response; 59 | } 60 | 61 | /** 62 | * Get specific application 63 | * 64 | * @param integer $reference Application reference 65 | * @return object 66 | */ 67 | public function getSpecific($reference) 68 | { 69 | ApiDebug::p(__FUNCTION__); 70 | 71 | $response = $this->_client->get('/hr/v4/contractors/applications/' . $reference); 72 | ApiDebug::p('found response info', $response); 73 | 74 | return $response; 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /src/Upwork/API/Routers/Hr/Freelancers/Offers.php: -------------------------------------------------------------------------------- 1 | 11 | * @license Upwork's API Terms of Use {@link https://developers.upwork.com/api-tos.html} 12 | */ 13 | 14 | namespace Upwork\API\Routers\Hr\Freelancers; 15 | 16 | use Upwork\API\Debug as ApiDebug; 17 | use Upwork\API\Client as ApiClient; 18 | 19 | /** 20 | * Freelancer Job Offers API 21 | * 22 | * @link http://developers.upwork.com/w/page/70448095/Contractor%20Offers 23 | */ 24 | final class Offers extends ApiClient 25 | { 26 | const ENTRY_POINT = UPWORK_API_EP_NAME; 27 | 28 | /** 29 | * @var Client instance 30 | */ 31 | private $_client; 32 | 33 | /** 34 | * Constructor 35 | * 36 | * @param ApiClient $client Client object 37 | */ 38 | public function __construct(ApiClient $client) 39 | { 40 | ApiDebug::p('init ' . __CLASS__ . ' router'); 41 | $this->_client = $client; 42 | parent::$_epoint = self::ENTRY_POINT; 43 | } 44 | 45 | /** 46 | * Get list of offers 47 | * 48 | * @param array $params Parameters 49 | * @return object 50 | */ 51 | public function getList($params) 52 | { 53 | ApiDebug::p(__FUNCTION__); 54 | 55 | $response = $this->_client->get('/offers/v1/contractors/offers', $params); 56 | ApiDebug::p('found response info', $response); 57 | 58 | return $response; 59 | } 60 | 61 | /** 62 | * Get specific offer 63 | * 64 | * @param integer $reference Offer reference 65 | * @return object 66 | */ 67 | public function getSpecific($reference) 68 | { 69 | ApiDebug::p(__FUNCTION__); 70 | 71 | $response = $this->_client->get('/offers/v1/contractors/offers/' . $reference); 72 | ApiDebug::p('found response info', $response); 73 | 74 | return $response; 75 | } 76 | 77 | /** 78 | * Run a specific action 79 | * 80 | * @param integer $reference Offer reference 81 | * @param array $params Prameters 82 | * @return object 83 | */ 84 | public function actions($reference, $params) 85 | { 86 | ApiDebug::p(__FUNCTION__); 87 | 88 | $response = $this->_client->post('/offers/v1/contractors/actions/' . $reference, $params); 89 | ApiDebug::p('found response info', $response); 90 | 91 | return $response; 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /src/Upwork/API/Routers/Hr/Interviews.php: -------------------------------------------------------------------------------- 1 | 11 | * @license Upwork's API Terms of Use {@link https://developers.upwork.com/api-tos.html} 12 | */ 13 | 14 | namespace Upwork\API\Routers\Hr; 15 | 16 | use Upwork\API\Debug as ApiDebug; 17 | use Upwork\API\Client as ApiClient; 18 | 19 | /** 20 | * Invite to Interview 21 | * 22 | * @link http://developers.upwork.com/w/page/23873221/Jobs%20HR%20API 23 | */ 24 | final class Interviews extends ApiClient 25 | { 26 | const ENTRY_POINT = UPWORK_API_EP_NAME; 27 | 28 | /** 29 | * @var Client instance 30 | */ 31 | private $_client; 32 | 33 | /** 34 | * Constructor 35 | * 36 | * @param ApiClient $client Client object 37 | */ 38 | public function __construct(ApiClient $client) 39 | { 40 | ApiDebug::p('init ' . __CLASS__ . ' router'); 41 | $this->_client = $client; 42 | parent::$_epoint = self::ENTRY_POINT; 43 | } 44 | 45 | /** 46 | * Invite to Interview 47 | * 48 | * @param string $jobKey Job key 49 | * @param array $params Parameters 50 | * @return object 51 | */ 52 | public function invite($jobKey, $params) 53 | { 54 | ApiDebug::p(__FUNCTION__); 55 | 56 | $response = $this->_client->post('/hr/v1/jobs/' . $jobKey . '/candidates', $params); 57 | ApiDebug::p('found response info', $response); 58 | 59 | return $response; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/Upwork/API/Routers/Hr/Roles.php: -------------------------------------------------------------------------------- 1 | 11 | * @license Upwork's API Terms of Use {@link https://developers.upwork.com/api-tos.html} 12 | */ 13 | 14 | namespace Upwork\API\Routers\Hr; 15 | 16 | use Upwork\API\Debug as ApiDebug; 17 | use Upwork\API\Client as ApiClient; 18 | 19 | /** 20 | * User Roles 21 | * 22 | * @link http://developers.upwork.com/User-Roles 23 | */ 24 | final class Roles extends ApiClient 25 | { 26 | const ENTRY_POINT = UPWORK_API_EP_NAME; 27 | 28 | /** 29 | * @var Client instance 30 | */ 31 | private $_client; 32 | 33 | /** 34 | * Constructor 35 | * 36 | * @param ApiClient $client Client object 37 | */ 38 | public function __construct(ApiClient $client) 39 | { 40 | ApiDebug::p('init ' . __CLASS__ . ' router'); 41 | $this->_client = $client; 42 | parent::$_epoint = self::ENTRY_POINT; 43 | } 44 | 45 | /** 46 | * Get user roles 47 | * 48 | * @return object 49 | */ 50 | public function getAll() 51 | { 52 | ApiDebug::p(__FUNCTION__); 53 | 54 | $roles = $this->_client->get('/hr/v2/userroles'); 55 | ApiDebug::p('found response info', $roles); 56 | 57 | return $roles; 58 | } 59 | 60 | /** 61 | * Get by specific user 62 | * 63 | * @param integer $reference User reference 64 | * @return object 65 | */ 66 | public function getBySpecificUser($reference) 67 | { 68 | ApiDebug::p(__FUNCTION__); 69 | 70 | $roles = $this->_client->get('/hr/v2/userroles/' . $reference); 71 | ApiDebug::p('found auth info', $roles); 72 | 73 | return $roles; 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /src/Upwork/API/Routers/Hr/Submissions.php: -------------------------------------------------------------------------------- 1 | 11 | * @license Upwork's API Terms of Use {@link https://developers.upwork.com/api-tos.html} 12 | */ 13 | 14 | namespace Upwork\API\Routers\Hr; 15 | 16 | use Upwork\API\Debug as ApiDebug; 17 | use Upwork\API\Client as ApiClient; 18 | 19 | /** 20 | * Submissions 21 | * 22 | * @link https://developers.upwork.com/?lang=php#contracts-and-offers 23 | */ 24 | final class Submissions extends ApiClient 25 | { 26 | const ENTRY_POINT = UPWORK_API_EP_NAME; 27 | 28 | /** 29 | * @var Client instance 30 | */ 31 | private $_client; 32 | 33 | /** 34 | * Constructor 35 | * 36 | * @param ApiClient $client Client object 37 | */ 38 | public function __construct(ApiClient $client) 39 | { 40 | ApiDebug::p('init ' . __CLASS__ . ' router'); 41 | $this->_client = $client; 42 | parent::$_epoint = self::ENTRY_POINT; 43 | } 44 | 45 | /** 46 | * Freelancer submits work for the client to approve 47 | * 48 | * @param array $params Parameters 49 | * @return object 50 | */ 51 | public function requestApproval($params) 52 | { 53 | ApiDebug::p(__FUNCTION__); 54 | 55 | $response = $this->_client->post('/hr/v3/fp/submissions', $params); 56 | ApiDebug::p('found response info', $response); 57 | 58 | return $response; 59 | } 60 | 61 | /** 62 | * Approve an existing Submission 63 | * 64 | * @param integer Submission ID 65 | * @param array $params Parameters 66 | * @return object 67 | */ 68 | public function approve($submissionId, $params) 69 | { 70 | ApiDebug::p(__FUNCTION__); 71 | 72 | $response = $this->_client->put('/hr/v3/fp/submissions/' . $submissionId . '/approve', $params); 73 | ApiDebug::p('found response info', $response); 74 | 75 | return $response; 76 | } 77 | 78 | /** 79 | * Reject an existing Submission 80 | * 81 | * @param integer Submission ID 82 | * @param array $params Parameters 83 | * @return object 84 | */ 85 | public function reject($submissionId, $params) 86 | { 87 | ApiDebug::p(__FUNCTION__); 88 | 89 | $response = $this->_client->put('/hr/v3/fp/submissions/' . $submissionId . '/reject', $params); 90 | ApiDebug::p('found response info', $response); 91 | 92 | return $response; 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /src/Upwork/API/Routers/Jobs/Profile.php: -------------------------------------------------------------------------------- 1 | 11 | * @license Upwork's API Terms of Use {@link https://developers.upwork.com/api-tos.html} 12 | */ 13 | 14 | namespace Upwork\API\Routers\Jobs; 15 | 16 | use Upwork\API\Debug as ApiDebug; 17 | use Upwork\API\Client as ApiClient; 18 | 19 | /** 20 | * Job Profile 21 | * 22 | * @link http://developers.upwork.com/w/page/49065901/Job%20Profile 23 | */ 24 | final class Profile extends ApiClient 25 | { 26 | const ENTRY_POINT = UPWORK_API_EP_NAME; 27 | 28 | /** 29 | * @var Client instance 30 | */ 31 | private $_client; 32 | 33 | /** 34 | * Constructor 35 | * 36 | * @param ApiClient $client Client object 37 | */ 38 | public function __construct(ApiClient $client) 39 | { 40 | ApiDebug::p('init ' . __CLASS__ . ' router'); 41 | $this->_client = $client; 42 | parent::$_epoint = self::ENTRY_POINT; 43 | } 44 | 45 | /** 46 | * Get specific Job Profile 47 | * 48 | * @param string $key Profile key 49 | * @return object 50 | */ 51 | public function getSpecific($key) 52 | { 53 | ApiDebug::p(__FUNCTION__); 54 | 55 | $response = $this->_client->get('/profiles/v1/jobs/' . $key); 56 | ApiDebug::p('found response info', $response); 57 | 58 | return $response; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/Upwork/API/Routers/Jobs/Search.php: -------------------------------------------------------------------------------- 1 | 11 | * @license Upwork's API Terms of Use {@link https://developers.upwork.com/api-tos.html} 12 | */ 13 | 14 | namespace Upwork\API\Routers\Jobs; 15 | 16 | use Upwork\API\Debug as ApiDebug; 17 | use Upwork\API\Client as ApiClient; 18 | 19 | /** 20 | * Search Jobs 21 | * 22 | * @link http://developers.upwork.com/search-jobs 23 | */ 24 | final class Search extends ApiClient 25 | { 26 | const ENTRY_POINT = UPWORK_API_EP_NAME; 27 | 28 | /** 29 | * @var Client instance 30 | */ 31 | private $_client; 32 | 33 | /** 34 | * Constructor 35 | * 36 | * @param ApiClient $client Client object 37 | */ 38 | public function __construct(ApiClient $client) 39 | { 40 | ApiDebug::p('init ' . __CLASS__ . ' router'); 41 | $this->_client = $client; 42 | parent::$_epoint = self::ENTRY_POINT; 43 | } 44 | 45 | /** 46 | * Search jobs 47 | * 48 | * @param array $params (Optional) Parameters 49 | * @return object 50 | */ 51 | public function find($params = array()) 52 | { 53 | ApiDebug::p(__FUNCTION__); 54 | 55 | $response = $this->_client->get('/profiles/v2/search/jobs', $params); 56 | ApiDebug::p('found response info', $response); 57 | 58 | return $response; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/Upwork/API/Routers/Organization/Companies.php: -------------------------------------------------------------------------------- 1 | 11 | * @license Upwork's API Terms of Use {@link https://developers.upwork.com/api-tos.html} 12 | */ 13 | 14 | namespace Upwork\API\Routers\Organization; 15 | 16 | use Upwork\API\Debug as ApiDebug; 17 | use Upwork\API\Client as ApiClient; 18 | 19 | /** 20 | * Get companies 21 | * 22 | * @link http://developers.upwork.com/Organization-APIs 23 | */ 24 | final class Companies extends ApiClient 25 | { 26 | const ENTRY_POINT = UPWORK_API_EP_NAME; 27 | 28 | /** 29 | * @var Client instance 30 | */ 31 | private $_client; 32 | 33 | /** 34 | * Constructor 35 | * 36 | * @param ApiClient $client Client object 37 | */ 38 | public function __construct(ApiClient $client) 39 | { 40 | ApiDebug::p('init ' . __CLASS__ . ' router'); 41 | $this->_client = $client; 42 | parent::$_epoint = self::ENTRY_POINT; 43 | } 44 | 45 | /** 46 | * Get Companies Info 47 | * 48 | * @return object 49 | */ 50 | public function getList() 51 | { 52 | ApiDebug::p(__FUNCTION__); 53 | 54 | $response = $this->_client->get('/hr/v2/companies'); 55 | ApiDebug::p('found response info', $response); 56 | 57 | return $response; 58 | } 59 | 60 | /** 61 | * Get Specific Company 62 | * 63 | * @param integer $cmpReference Company reference 64 | * @return object 65 | */ 66 | public function getSpecific($cmpReference) 67 | { 68 | ApiDebug::p(__FUNCTION__); 69 | 70 | $response = $this->_client->get('/hr/v2/companies/' . $cmpReference); 71 | ApiDebug::p('found response info', $response); 72 | 73 | return $response; 74 | } 75 | 76 | /** 77 | * Get Teams in Company 78 | * 79 | * @param integer $cmpReference Company reference 80 | * @return object 81 | */ 82 | public function getTeams($cmpReference) 83 | { 84 | ApiDebug::p(__FUNCTION__); 85 | 86 | $response = $this->_client->get('/hr/v2/companies/' . $cmpReference . '/teams'); 87 | ApiDebug::p('found response info', $response); 88 | 89 | return $response; 90 | } 91 | 92 | /** 93 | * Get Users in Company 94 | * 95 | * @param integer $cmpReference Company reference 96 | * @return object 97 | */ 98 | public function getUsers($cmpReference) 99 | { 100 | ApiDebug::p(__FUNCTION__); 101 | 102 | $response = $this->_client->get('/hr/v2/companies/' . $cmpReference . '/users'); 103 | ApiDebug::p('found response info', $response); 104 | 105 | return $response; 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /src/Upwork/API/Routers/Organization/Teams.php: -------------------------------------------------------------------------------- 1 | 11 | * @license Upwork's API Terms of Use {@link https://developers.upwork.com/api-tos.html} 12 | */ 13 | 14 | namespace Upwork\API\Routers\Organization; 15 | 16 | use Upwork\API\Debug as ApiDebug; 17 | use Upwork\API\Client as ApiClient; 18 | 19 | /** 20 | * Teams info 21 | * 22 | * @link http://developers.upwork.com/Organization-APIs 23 | */ 24 | final class Teams extends ApiClient 25 | { 26 | const ENTRY_POINT = UPWORK_API_EP_NAME; 27 | 28 | /** 29 | * @var Client instance 30 | */ 31 | private $_client; 32 | 33 | /** 34 | * Constructor 35 | * 36 | * @param ApiClient $client Client object 37 | */ 38 | public function __construct(ApiClient $client) 39 | { 40 | ApiDebug::p('init ' . __CLASS__ . ' router'); 41 | $this->_client = $client; 42 | parent::$_epoint = self::ENTRY_POINT; 43 | } 44 | 45 | /** 46 | * Get Teams info 47 | * 48 | * @return object 49 | */ 50 | public function getList() 51 | { 52 | ApiDebug::p(__FUNCTION__); 53 | 54 | $response = $this->_client->get('/hr/v2/teams'); 55 | ApiDebug::p('found response info', $response); 56 | 57 | return $response; 58 | } 59 | 60 | /** 61 | * Get Users in Team 62 | * 63 | * @param integer $teamReference Team reference 64 | * @return object 65 | */ 66 | public function getUsersInTeam($teamReference) 67 | { 68 | ApiDebug::p(__FUNCTION__); 69 | 70 | $response = $this->_client->get('/hr/v2/teams/' . $teamReference . '/users'); 71 | ApiDebug::p('found response info', $response); 72 | 73 | return $response; 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /src/Upwork/API/Routers/Organization/Users.php: -------------------------------------------------------------------------------- 1 | 11 | * @license Upwork's API Terms of Use {@link https://developers.upwork.com/api-tos.html} 12 | */ 13 | 14 | namespace Upwork\API\Routers\Organization; 15 | 16 | use Upwork\API\Debug as ApiDebug; 17 | use Upwork\API\Client as ApiClient; 18 | 19 | /** 20 | * Get user info 21 | * 22 | * @link http://developers.upwork.com/Organization-APIs 23 | */ 24 | final class Users extends ApiClient 25 | { 26 | const ENTRY_POINT = UPWORK_API_EP_NAME; 27 | 28 | /** 29 | * @var Client instance 30 | */ 31 | private $_client; 32 | 33 | /** 34 | * Constructor 35 | * 36 | * @param ApiClient $client Client object 37 | */ 38 | public function __construct(ApiClient $client) 39 | { 40 | ApiDebug::p('init ' . __CLASS__ . ' router'); 41 | $this->_client = $client; 42 | parent::$_epoint = self::ENTRY_POINT; 43 | } 44 | 45 | /** 46 | * Get Auth User Info 47 | * 48 | * @return object 49 | */ 50 | public function getMyInfo() 51 | { 52 | ApiDebug::p(__FUNCTION__); 53 | 54 | $response = $this->_client->get('/hr/v2/users/me'); 55 | ApiDebug::p('found response info', $response); 56 | 57 | return $response; 58 | } 59 | 60 | /** 61 | * Get Specific User Info 62 | * 63 | * @param integer $userReference User Reference 64 | * @return object 65 | */ 66 | public function getSpecific($userReference) 67 | { 68 | ApiDebug::p(__FUNCTION__); 69 | 70 | $response = $this->_client->get('/hr/v2/users/' . $userReference); 71 | ApiDebug::p('found response info', $response); 72 | 73 | return $response; 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /src/Upwork/API/Routers/Payments.php: -------------------------------------------------------------------------------- 1 | 11 | * @license Upwork's API Terms of Use {@link https://developers.upwork.com/api-tos.html} 12 | */ 13 | 14 | namespace Upwork\API\Routers; 15 | 16 | use Upwork\API\Debug as ApiDebug; 17 | use Upwork\API\Client as ApiClient; 18 | 19 | /** 20 | * Custom Payments 21 | * 22 | * @link http://developers.upwork.com/Custom-Payment-API 23 | */ 24 | final class Payments extends ApiClient 25 | { 26 | const ENTRY_POINT = UPWORK_API_EP_NAME; 27 | 28 | /** 29 | * @var Client instance 30 | */ 31 | private $_client; 32 | 33 | /** 34 | * Constructor 35 | * 36 | * @param ApiClient $client Client object 37 | */ 38 | public function __construct(ApiClient $client) 39 | { 40 | ApiDebug::p('init ' . __CLASS__ . ' router'); 41 | $this->_client = $client; 42 | parent::$_epoint = self::ENTRY_POINT; 43 | } 44 | 45 | /** 46 | * Submit a Custom Payment 47 | * 48 | * @param integer $teamReference Team reference 49 | * @param array $params Parameters 50 | * @return object 51 | */ 52 | public function submitBonus($teamReference, $params) 53 | { 54 | ApiDebug::p(__FUNCTION__); 55 | 56 | $adjustments = $this->_client->post('/hr/v2/teams/' . $teamReference . '/adjustments', $params); 57 | ApiDebug::p('found adjustments info', $adjustments); 58 | 59 | return $adjustments; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/Upwork/API/Routers/Reports/Finance/Accounts.php: -------------------------------------------------------------------------------- 1 | 11 | * @license Upwork's API Terms of Use {@link https://developers.upwork.com/api-tos.html} 12 | */ 13 | 14 | namespace Upwork\API\Routers\Reports\Finance; 15 | 16 | use Upwork\API\Debug as ApiDebug; 17 | use Upwork\API\Client as ApiClient; 18 | 19 | /** 20 | * Financial Reporting 21 | * 22 | * @link http://developers.upwork.com/Financial-Reports-GDS-API 23 | */ 24 | final class Accounts extends ApiClient 25 | { 26 | const ENTRY_POINT = UPWORK_GDS_EP_NAME; 27 | 28 | /** 29 | * @var Client instance 30 | */ 31 | private $_client; 32 | 33 | /** 34 | * Constructor 35 | * 36 | * @param ApiClient $client Client object 37 | */ 38 | public function __construct(ApiClient $client) 39 | { 40 | ApiDebug::p('init ' . __CLASS__ . ' router'); 41 | $this->_client = $client; 42 | parent::$_epoint = self::ENTRY_POINT; 43 | } 44 | 45 | /** 46 | * Generate Financial Reports for a Specific Account 47 | * 48 | * @param integer $entityReference Entity reference 49 | * @param array $params Parameters 50 | * @return object 51 | */ 52 | public function getSpecific($entityReference, $params) 53 | { 54 | ApiDebug::p(__FUNCTION__); 55 | 56 | $report = $this->_client->get('/finreports/v2/financial_accounts/' . $entityReference, $params); 57 | ApiDebug::p('found auth info', $report); 58 | 59 | return $report; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/Upwork/API/Routers/Reports/Finance/Billings.php: -------------------------------------------------------------------------------- 1 | 11 | * @license Upwork's API Terms of Use {@link https://developers.upwork.com/api-tos.html} 12 | */ 13 | 14 | namespace Upwork\API\Routers\Reports\Finance; 15 | 16 | use Upwork\API\Debug as ApiDebug; 17 | use Upwork\API\Client as ApiClient; 18 | 19 | /** 20 | * Financial Reporting 21 | * 22 | * @link http://developers.upwork.com/Financial-Reports-GDS-API 23 | */ 24 | final class Billings extends ApiClient 25 | { 26 | const ENTRY_POINT = UPWORK_GDS_EP_NAME; 27 | 28 | /** 29 | * @var Client instance 30 | */ 31 | private $_client; 32 | 33 | /** 34 | * Constructor 35 | * 36 | * @param ApiClient $client Client object 37 | */ 38 | public function __construct(ApiClient $client) 39 | { 40 | ApiDebug::p('init ' . __CLASS__ . ' router'); 41 | $this->_client = $client; 42 | parent::$_epoint = self::ENTRY_POINT; 43 | } 44 | 45 | /** 46 | * Generate Billing Reports for a Specific Freelancer 47 | * 48 | * @param integer $freelancerReference Freelancer reference 49 | * @param array $params Parameters 50 | * @return object 51 | */ 52 | public function getByFreelancer($freelancerReference, $params) 53 | { 54 | ApiDebug::p(__FUNCTION__); 55 | 56 | $report = $this->_client->get('/finreports/v2/providers/' . $freelancerReference . '/billings', $params); 57 | ApiDebug::p('found report info', $report); 58 | 59 | return $report; 60 | } 61 | 62 | /** 63 | * Generate Billing Reports for a Specific Buyer's Team 64 | * 65 | * @param integer $buyerTeamReference Buyer team reference 66 | * @param array $params Parameters 67 | * @return object 68 | */ 69 | public function getByBuyersTeam($buyerTeamReference, $params) 70 | { 71 | ApiDebug::p(__FUNCTION__); 72 | 73 | $report = $this->_client->get('/finreports/v2/buyer_teams/' . $buyerTeamReference . '/billings', $params); 74 | ApiDebug::p('found report info', $report); 75 | 76 | return $report; 77 | } 78 | 79 | /** 80 | * Generate Billing Reports for a Specific Buyer's Company 81 | * 82 | * @param integer $buyerCompanyReference Buyer company reference 83 | * @param array $params Parameters 84 | * @return object 85 | */ 86 | public function getByBuyersCompany($buyerCompanyReference, $params) 87 | { 88 | ApiDebug::p(__FUNCTION__); 89 | 90 | $report = $this->_client->get('/finreports/v2/buyer_companies/' . $buyerCompanyReference . '/billings', $params); 91 | ApiDebug::p('found report info', $report); 92 | 93 | return $report; 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /src/Upwork/API/Routers/Reports/Finance/Earnings.php: -------------------------------------------------------------------------------- 1 | 11 | * @license Upwork's API Terms of Use {@link https://developers.upwork.com/api-tos.html} 12 | */ 13 | 14 | namespace Upwork\API\Routers\Reports\Finance; 15 | 16 | use Upwork\API\Debug as ApiDebug; 17 | use Upwork\API\Client as ApiClient; 18 | 19 | /** 20 | * Financial Reporting 21 | * 22 | * @link http://developers.upwork.com/Financial-Reports-GDS-API 23 | */ 24 | final class Earnings extends ApiClient 25 | { 26 | const ENTRY_POINT = UPWORK_GDS_EP_NAME; 27 | 28 | /** 29 | * @var Client instance 30 | */ 31 | private $_client; 32 | 33 | /** 34 | * Constructor 35 | * 36 | * @param ApiClient $client Client object 37 | */ 38 | public function __construct(ApiClient $client) 39 | { 40 | ApiDebug::p('init ' . __CLASS__ . ' router'); 41 | $this->_client = $client; 42 | parent::$_epoint = self::ENTRY_POINT; 43 | } 44 | 45 | /** 46 | * Generate Earning Reports for a Specific Freelancer 47 | * 48 | * @param integer $freelancerReference Freelancer reference 49 | * @param array $params Parameters 50 | * @return object 51 | */ 52 | public function getByFreelancer($freelancerReference, $params) 53 | { 54 | ApiDebug::p(__FUNCTION__); 55 | 56 | $report = $this->_client->get('/finreports/v2/providers/' . $freelancerReference . '/earnings', $params); 57 | ApiDebug::p('found report info', $report); 58 | 59 | return $report; 60 | } 61 | 62 | /** 63 | * Generate Earning Reports for a Specific Buyer's Team 64 | * 65 | * @param integer $buyerTeamReference Buyer team reference 66 | * @param array $params Parameters 67 | * @return object 68 | */ 69 | public function getByBuyersTeam($buyerTeamReference, $params) 70 | { 71 | ApiDebug::p(__FUNCTION__); 72 | 73 | $report = $this->_client->get('/finreports/v2/buyer_teams/' . $buyerTeamReference . '/earnings', $params); 74 | ApiDebug::p('found report info', $report); 75 | 76 | return $report; 77 | } 78 | 79 | /** 80 | * Generate Earning Reports for a Specific Buyer's Company 81 | * 82 | * @param integer $buyerCompanyReference Buyer company reference 83 | * @param array $params Parameters 84 | * @return object 85 | */ 86 | public function getByBuyersCompany($buyerCompanyReference, $params) 87 | { 88 | ApiDebug::p(__FUNCTION__); 89 | 90 | $report = $this->_client->get('/finreports/v2/buyer_companies/' . $buyerCompanyReference . '/earnings', $params); 91 | ApiDebug::p('found report info', $report); 92 | 93 | return $report; 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /src/Upwork/API/Routers/Snapshot.php: -------------------------------------------------------------------------------- 1 | 11 | * @license Upwork's API Terms of Use {@link https://developers.upwork.com/api-tos.html} 12 | */ 13 | 14 | namespace Upwork\API\Routers; 15 | 16 | use Upwork\API\Debug as ApiDebug; 17 | use Upwork\API\Client as ApiClient; 18 | 19 | /** 20 | * Snapshot info 21 | * 22 | * @link http://developers.upwork.com/Snapshot 23 | */ 24 | final class Snapshot extends ApiClient 25 | { 26 | const ENTRY_POINT = UPWORK_API_EP_NAME; 27 | 28 | /** 29 | * @var Client instance 30 | */ 31 | private $_client; 32 | 33 | /** 34 | * Constructor 35 | * 36 | * @param ApiClient $client Client object 37 | */ 38 | public function __construct(ApiClient $client) 39 | { 40 | ApiDebug::p('init ' . __CLASS__ . ' router'); 41 | $this->_client = $client; 42 | parent::$_epoint = self::ENTRY_POINT; 43 | } 44 | 45 | /** 46 | * Get snapshot info by specific contract 47 | * 48 | * @param string $contractId Contract ID 49 | * @param string $ts Timestamp 50 | * @return object 51 | */ 52 | public function getByContract($contractId, $ts) 53 | { 54 | ApiDebug::p(__FUNCTION__); 55 | 56 | $response = $this->_client->get('/team/v3/snapshots/contracts/' . $contractId . '/' . $ts); 57 | ApiDebug::p('found response info', $response); 58 | 59 | return $response; 60 | } 61 | 62 | /** 63 | * Update snapshot by specific contract 64 | * 65 | * @param string $contractId Contract ID 66 | * @param string $ts Timestamp 67 | * @param array $params Parameters 68 | * @return object 69 | */ 70 | public function updateByContract($contractId, $ts, $params) 71 | { 72 | ApiDebug::p(__FUNCTION__); 73 | 74 | $response = $this->_client->put('/team/v3/snapshots/contracts/' . $contractId . '/' . $ts, $params); 75 | ApiDebug::p('found response info', $response); 76 | 77 | return $response; 78 | } 79 | 80 | /** 81 | * Delete snapshot by specific contract 82 | * 83 | * @param string $contractId Contract ID 84 | * @param string $ts Timestamp 85 | * @return object 86 | */ 87 | public function deleteByContract($contractId, $ts) 88 | { 89 | ApiDebug::p(__FUNCTION__); 90 | 91 | $response = $this->_client->delete('/team/v3/snapshots/contracts/' . $contractId . '/' . $ts); 92 | ApiDebug::p('found response info', $response); 93 | 94 | return $response; 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /src/Upwork/API/Routers/Workdays.php: -------------------------------------------------------------------------------- 1 | 11 | * @license Upwork's API Terms of Use {@link https://developers.upwork.com/api-tos.html} 12 | */ 13 | 14 | namespace Upwork\API\Routers; 15 | 16 | use Upwork\API\Debug as ApiDebug; 17 | use Upwork\API\Client as ApiClient; 18 | 19 | /** 20 | * Workdays API 21 | * 22 | * @link http://developers.upwork.com/#companies-and-teams_get-workdays-by-company 23 | */ 24 | final class Workdays extends ApiClient 25 | { 26 | const ENTRY_POINT = UPWORK_API_EP_NAME; 27 | 28 | /** 29 | * @var Client instance 30 | */ 31 | private $_client; 32 | 33 | /** 34 | * Constructor 35 | * 36 | * @param ApiClient $client Client object 37 | */ 38 | public function __construct(ApiClient $client) 39 | { 40 | ApiDebug::p('init ' . __CLASS__ . ' router'); 41 | $this->_client = $client; 42 | parent::$_epoint = self::ENTRY_POINT; 43 | } 44 | 45 | /** 46 | * Get Workdays 47 | * 48 | * @param string $company Company ID 49 | * @param string $fromDate Start date 50 | * @param string $tillDate Till date 51 | * @param array $params (Optional) Parameters 52 | * @return object 53 | */ 54 | public function getByCompany($company, $fromDate, $tillDate, $params = array()) 55 | { 56 | ApiDebug::p(__FUNCTION__); 57 | 58 | $response = $this->_client->get('/team/v3/workdays/companies/' . $company . '/' . $fromDate . ',' . $tillDate, $params); 59 | ApiDebug::p('found response info', $response); 60 | 61 | return $response; 62 | } 63 | 64 | /** 65 | * Get Workdiary by Contract 66 | * 67 | * @param string $contract Contract ID 68 | * @param string $fromDate Start date 69 | * @param string $tillDate Till date 70 | * @param array $params (Optional) Parameters 71 | * @return object 72 | */ 73 | public function getByContract($contract, $fromDate, $tillDate, $params = array()) 74 | { 75 | ApiDebug::p(__FUNCTION__); 76 | 77 | $response = $this->_client->get('/team/v3/workdays/contracts/' . $contract . '/' . $fromDate . ',' . $tillDate, $params); 78 | ApiDebug::p('found response info', $response); 79 | 80 | return $response; 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /src/Upwork/API/Routers/Workdiary.php: -------------------------------------------------------------------------------- 1 | 11 | * @license Upwork's API Terms of Use {@link https://developers.upwork.com/api-tos.html} 12 | */ 13 | 14 | namespace Upwork\API\Routers; 15 | 16 | use Upwork\API\Debug as ApiDebug; 17 | use Upwork\API\Client as ApiClient; 18 | 19 | /** 20 | * Workdiary API 21 | * 22 | * @link http://developers.upwork.com/Work-Diary 23 | */ 24 | final class Workdiary extends ApiClient 25 | { 26 | const ENTRY_POINT = UPWORK_API_EP_NAME; 27 | 28 | /** 29 | * @var Client instance 30 | */ 31 | private $_client; 32 | 33 | /** 34 | * Constructor 35 | * 36 | * @param ApiClient $client Client object 37 | */ 38 | public function __construct(ApiClient $client) 39 | { 40 | ApiDebug::p('init ' . __CLASS__ . ' router'); 41 | $this->_client = $client; 42 | parent::$_epoint = self::ENTRY_POINT; 43 | } 44 | 45 | /** 46 | * Get Workdiary 47 | * 48 | * @param string $company Company ID 49 | * @param string $date Date 50 | * @param array $params (Optional) Parameters 51 | * @return object 52 | */ 53 | public function getByCompany($company, $date, $params = array()) 54 | { 55 | ApiDebug::p(__FUNCTION__); 56 | 57 | $response = $this->_client->get('/team/v3/workdiaries/companies/' . $company . '/' . $date, $params); 58 | ApiDebug::p('found response info', $response); 59 | 60 | return $response; 61 | } 62 | 63 | /** 64 | * Get Workdiary by Contract 65 | * 66 | * @param string $contract Contract ID 67 | * @param string $date Date 68 | * @param array $params (Optional) Parameters 69 | * @return object 70 | */ 71 | public function getByContract($contract, $date, $params = array()) 72 | { 73 | ApiDebug::p(__FUNCTION__); 74 | 75 | $response = $this->_client->get('/team/v3/workdiaries/contracts/' . $contract . '/' . $date, $params); 76 | ApiDebug::p('found response info', $response); 77 | 78 | return $response; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /src/Upwork/API/Utils.php: -------------------------------------------------------------------------------- 1 | 10 | * @license Upwork's API Terms of Use {@link https://developers.upwork.com/api-tos.html} 11 | */ 12 | 13 | namespace Upwork\API; 14 | 15 | use Upwork\API\Debug as ApiDebug; 16 | 17 | /** 18 | * Utils 19 | */ 20 | final class Utils 21 | { 22 | /** 23 | * Get full url, based on global constant 24 | * 25 | * @param string $url Relative URL 26 | * @param string $ep (Optional) Entry point 27 | * @static 28 | * @access public 29 | * @return string 30 | */ 31 | static public function getFullUrl($url, $ep = null) 32 | { 33 | ApiDebug::p('create full url, based on global constant'); 34 | 35 | $name = ($ep) 36 | ? 'UPWORK_BASE_URL_' . strtoupper($ep) 37 | : 'UPWORK_BASE_URL'; 38 | 39 | $fullUrl = constant($name) . $url; 40 | ApiDebug::p('url', $fullUrl); 41 | 42 | return $fullUrl; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/Upwork/API/constants.php: -------------------------------------------------------------------------------- 1 | 10 | * @license Upwork's API Terms of Use {@link https://developers.upwork.com/api-tos.html} 11 | */ 12 | 13 | define('UPWORK_API_EP_NAME', 'api'); 14 | define('UPWORK_GDS_EP_NAME', 'gds'); 15 | define('UPWORK_BASE_URL', 'https://www.upwork.com'); 16 | define('UPWORK_BASE_URL_API', UPWORK_BASE_URL . '/' . UPWORK_API_EP_NAME); 17 | define('UPWORK_BASE_URL_GDS', UPWORK_BASE_URL . '/' . UPWORK_GDS_EP_NAME); 18 | -------------------------------------------------------------------------------- /tests/Upwork/API/ApiExceptionTest.php: -------------------------------------------------------------------------------- 1 | expectException(\Upwork\API\ApiException::class); 17 | throw new ApiException('test'); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /tests/Upwork/API/ConfigTest.php: -------------------------------------------------------------------------------- 1 | expectException(\Upwork\API\ApiException::class); 18 | throw new ApiException('test'); 19 | } 20 | 21 | /** 22 | * @test 23 | */ 24 | public function testDefaultProperty() 25 | { 26 | $reflection = new \ReflectionClass('Upwork\API\Config'); 27 | $property = $reflection->getProperty('_verifySsl'); 28 | $property->setAccessible(true); 29 | $helper = new Config(array()); 30 | $property->setValue($helper, true); 31 | $helper->__construct(array()); // will not change the attribute value 32 | $this->assertTrue($helper::get('verifySsl')); 33 | } 34 | 35 | /** 36 | * @test 37 | */ 38 | public function testSetProperty() 39 | { 40 | $reflection = new \ReflectionClass(Config::class); 41 | $property = $reflection->getProperty('_verifySsl'); 42 | $property->setAccessible(true); 43 | $helper = new Config(array()); 44 | $property->setValue($helper, false); 45 | $helper->__construct(array('verifySsl' => true)); 46 | $this->assertTrue($helper::get('verifySsl')); 47 | } 48 | 49 | /** 50 | * @test 51 | */ 52 | public function testGetProperty() 53 | { 54 | $config = new Config(array('verifySsl' => false)); 55 | $property = $config::get('verifySsl'); 56 | $this->assertFalse($property); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /tests/Upwork/API/DebugTest.php: -------------------------------------------------------------------------------- 1 | getProperty('_debug'); 18 | $property->setAccessible(true); 19 | $helper = new ApiDebug(); 20 | $property->setValue($helper, true); 21 | 22 | ob_start(); 23 | ApiDebug::p('test message'); 24 | $output = ob_get_contents(); 25 | ob_end_clean(); 26 | 27 | $this->assertStringContainsString('test message', $output); 28 | $property->setValue($helper, false); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /tests/Upwork/API/Interfaces/ClientTest.php: -------------------------------------------------------------------------------- 1 | assertTrue($reflection->isInterface()); 17 | $this->assertTrue($reflection->hasMethod('auth')); 18 | $this->assertTrue($reflection->hasMethod('request')); 19 | $this->assertTrue($reflection->hasMethod('setupRequestToken')); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /tests/Upwork/API/Routers/Activities/EngagementTest.php: -------------------------------------------------------------------------------- 1 | _client); 24 | $response = $router->getSpecific('1234'); 25 | 26 | $this->_checkResponse($response); 27 | } 28 | 29 | /** 30 | * @test 31 | */ 32 | public function testAssign() 33 | { 34 | $router = new \Upwork\API\Routers\Activities\Engagement($this->_client); 35 | $response = $router->assign('company', 'team', '1234', array()); 36 | 37 | $this->_checkResponse($response); 38 | } 39 | 40 | /** 41 | * @test 42 | */ 43 | public function testAssignToEngagement() 44 | { 45 | $router = new \Upwork\API\Routers\Activities\Engagement($this->_client); 46 | $response = $router->assignToEngagement('1234', array()); 47 | 48 | $this->_checkResponse($response); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /tests/Upwork/API/Routers/Activities/TeamTest.php: -------------------------------------------------------------------------------- 1 | _client); 24 | $response = $router->getList('company', 'team'); 25 | 26 | $this->_checkResponse($response); 27 | } 28 | 29 | /** 30 | * @test 31 | */ 32 | public function testGetSpecificList() 33 | { 34 | $router = new \Upwork\API\Routers\Activities\Team($this->_client); 35 | $response = $router->getSpecificList('company', 'team', 'code'); 36 | 37 | $this->_checkResponse($response); 38 | } 39 | 40 | /** 41 | * @test 42 | */ 43 | public function testAddActivity() 44 | { 45 | $router = new \Upwork\API\Routers\Activities\Team($this->_client); 46 | $response = $router->addActivity('company', 'team', array()); 47 | 48 | $this->_checkResponse($response); 49 | } 50 | 51 | /** 52 | * @test 53 | */ 54 | public function testUpdateActivity() 55 | { 56 | $router = new \Upwork\API\Routers\Activities\Team($this->_client); 57 | $response = $router->updateActivity('company', 'team', 'code', array()); 58 | 59 | $this->_checkResponse($response); 60 | } 61 | 62 | /** 63 | * @test 64 | */ 65 | public function testArchiveActivities() 66 | { 67 | $router = new \Upwork\API\Routers\Activities\Team($this->_client); 68 | $response = $router->archiveActivities('company', 'team', 'code'); 69 | 70 | $this->_checkResponse($response); 71 | } 72 | 73 | /** 74 | * @test 75 | */ 76 | public function testUnarchiveActivities() 77 | { 78 | $router = new \Upwork\API\Routers\Activities\Team($this->_client); 79 | $response = $router->UnarchiveActivities('company', 'team', 'code'); 80 | 81 | $this->_checkResponse($response); 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /tests/Upwork/API/Routers/AuthTest.php: -------------------------------------------------------------------------------- 1 | _client); 22 | $response = $router->getUserInfo(); 23 | 24 | $this->_checkResponse($response); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /tests/Upwork/API/Routers/CommonTestRouter.php: -------------------------------------------------------------------------------- 1 | 'key', 23 | 'consumerSecret' => 'secret' 24 | ) 25 | ); 26 | 27 | $result = new \StdClass; 28 | $result->server_time = '1111111111'; 29 | $result->auth_user = []; 30 | $result->body = 1; 31 | 32 | $stub = $this->getMockBuilder(\Upwork\API\Client::class) 33 | ->enableArgumentCloning() 34 | ->setConstructorArgs([$config]) 35 | ->getMock(); 36 | $stub->expects($this->any()) 37 | ->method('get') 38 | ->will($this->returnValue($result)); 39 | $stub->expects($this->any()) 40 | ->method('post') 41 | ->will($this->returnValue($result)); 42 | $stub->expects($this->any()) 43 | ->method('put') 44 | ->will($this->returnValue($result)); 45 | $stub->expects($this->any()) 46 | ->method('delete') 47 | ->will($this->returnValue($result)); 48 | 49 | $this->_client = $stub; 50 | } 51 | 52 | /** 53 | * Check tested response 54 | * 55 | * @param object $response Response from mocked client instance 56 | */ 57 | protected function _checkResponse($response) 58 | { 59 | $this->assertInstanceOf('StdClass', $response); 60 | $this->assertObjectHasAttribute('server_time', $response); 61 | $this->assertObjectHasAttribute('auth_user', $response); 62 | $this->assertObjectHasAttribute('body', $response); 63 | $this->assertIsString($response->server_time); 64 | $this->assertIsArray($response->auth_user); 65 | $this->assertIsInt($response->body); 66 | $this->assertSame('1111111111', $response->server_time); 67 | $this->assertSame(1, $response->body); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /tests/Upwork/API/Routers/Freelancers/ProfileTest.php: -------------------------------------------------------------------------------- 1 | _client); 24 | $response = $router->getSpecific('~profilekey'); 25 | 26 | $this->_checkResponse($response); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /tests/Upwork/API/Routers/Freelancers/SearchTest.php: -------------------------------------------------------------------------------- 1 | _client); 24 | $response = $router->find(array()); 25 | 26 | $this->_checkResponse($response); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /tests/Upwork/API/Routers/Hr/Clients/ApplicationsTest.php: -------------------------------------------------------------------------------- 1 | _client); 24 | $response = $router->getList(array()); 25 | 26 | $this->_checkResponse($response); 27 | } 28 | 29 | /** 30 | * @test 31 | */ 32 | public function testGetSpecific() 33 | { 34 | $router = new \Upwork\API\Routers\Hr\Clients\Applications($this->_client); 35 | $response = $router->getSpecific('12345', array()); 36 | 37 | $this->_checkResponse($response); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /tests/Upwork/API/Routers/Hr/Clients/OffersTest.php: -------------------------------------------------------------------------------- 1 | _client); 24 | $response = $router->getList(array()); 25 | 26 | $this->_checkResponse($response); 27 | } 28 | 29 | /** 30 | * @test 31 | */ 32 | public function testGetSpecific() 33 | { 34 | $router = new \Upwork\API\Routers\Hr\Clients\Offers($this->_client); 35 | $response = $router->getSpecific('12345', array()); 36 | 37 | $this->_checkResponse($response); 38 | } 39 | 40 | /** 41 | * @test 42 | */ 43 | public function testMakeOffer() 44 | { 45 | $router = new \Upwork\API\Routers\Hr\Clients\Offers($this->_client); 46 | $response = $router->makeOffer(array()); 47 | 48 | $this->_checkResponse($response); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /tests/Upwork/API/Routers/Hr/ContractsTest.php: -------------------------------------------------------------------------------- 1 | _client); 24 | $response = $router->suspendContract('11111', array()); 25 | 26 | $this->_checkResponse($response); 27 | } 28 | 29 | /** 30 | * @test 31 | */ 32 | public function testRestartContract() 33 | { 34 | $router = new \Upwork\API\Routers\Hr\Contracts($this->_client); 35 | $response = $router->restartContract('11111', array()); 36 | 37 | $this->_checkResponse($response); 38 | } 39 | 40 | /** 41 | * @test 42 | */ 43 | public function testEndContract() 44 | { 45 | $router = new \Upwork\API\Routers\Hr\Contracts($this->_client); 46 | $response = $router->endContract('11111', array()); 47 | 48 | $this->_checkResponse($response); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /tests/Upwork/API/Routers/Hr/EngagementsTest.php: -------------------------------------------------------------------------------- 1 | _client); 24 | $response = $router->getList(array()); 25 | 26 | $this->_checkResponse($response); 27 | } 28 | 29 | /** 30 | * @test 31 | */ 32 | public function testGetSpecific() 33 | { 34 | $router = new \Upwork\API\Routers\Hr\Engagements($this->_client); 35 | $response = $router->getSpecific('12345'); 36 | 37 | $this->_checkResponse($response); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /tests/Upwork/API/Routers/Hr/Freelancers/ApplicationsTest.php: -------------------------------------------------------------------------------- 1 | _client); 24 | $response = $router->getList(array()); 25 | 26 | $this->_checkResponse($response); 27 | } 28 | 29 | /** 30 | * @test 31 | */ 32 | public function testGetSpecific() 33 | { 34 | $router = new \Upwork\API\Routers\Hr\Freelancers\Applications($this->_client); 35 | $response = $router->getSpecific('12345'); 36 | 37 | $this->_checkResponse($response); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /tests/Upwork/API/Routers/Hr/Freelancers/OffersTest.php: -------------------------------------------------------------------------------- 1 | _client); 24 | $response = $router->getList(array()); 25 | 26 | $this->_checkResponse($response); 27 | } 28 | 29 | /** 30 | * @test 31 | */ 32 | public function testGetSpecific() 33 | { 34 | $router = new \Upwork\API\Routers\Hr\Freelancers\Offers($this->_client); 35 | $response = $router->getSpecific('12345'); 36 | 37 | $this->_checkResponse($response); 38 | } 39 | 40 | /** 41 | * @test 42 | */ 43 | public function testActions() 44 | { 45 | $router = new \Upwork\API\Routers\Hr\Freelancers\Offers($this->_client); 46 | $response = $router->actions('12345', array()); 47 | 48 | $this->_checkResponse($response); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /tests/Upwork/API/Routers/Hr/InterviewsTest.php: -------------------------------------------------------------------------------- 1 | _client); 24 | $response = $router->invite('~jobkey', array()); 25 | 26 | $this->_checkResponse($response); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /tests/Upwork/API/Routers/Hr/JobsTest.php: -------------------------------------------------------------------------------- 1 | _client); 24 | $response = $router->getList(array()); 25 | 26 | $this->_checkResponse($response); 27 | } 28 | 29 | /** 30 | * @test 31 | */ 32 | public function testGetSpecific() 33 | { 34 | $router = new \Upwork\API\Routers\Hr\Jobs($this->_client); 35 | $response = $router->getSpecific('~jobkey'); 36 | 37 | $this->_checkResponse($response); 38 | } 39 | 40 | /** 41 | * @test 42 | */ 43 | public function testPostJob() 44 | { 45 | $router = new \Upwork\API\Routers\Hr\Jobs($this->_client); 46 | $response = $router->postJob(array()); 47 | 48 | $this->_checkResponse($response); 49 | } 50 | 51 | /** 52 | * @test 53 | */ 54 | public function testEditJob() 55 | { 56 | $router = new \Upwork\API\Routers\Hr\Jobs($this->_client); 57 | $response = $router->editJob('~jobkey', array()); 58 | 59 | $this->_checkResponse($response); 60 | } 61 | 62 | /** 63 | * @test 64 | */ 65 | public function testDeleteJob() 66 | { 67 | $router = new \Upwork\API\Routers\Hr\Jobs($this->_client); 68 | $response = $router->deleteJob('~jobkey', array()); 69 | 70 | $this->_checkResponse($response); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /tests/Upwork/API/Routers/Hr/MilestonesTest.php: -------------------------------------------------------------------------------- 1 | _client); 24 | $response = $router->getActiveMilestone(1234); 25 | 26 | $this->_checkResponse($response); 27 | } 28 | 29 | /** 30 | * @test 31 | */ 32 | public function testGetSubmissions() 33 | { 34 | $router = new \Upwork\API\Routers\Hr\Milestones($this->_client); 35 | $response = $router->getSubmissions(1234); 36 | 37 | $this->_checkResponse($response); 38 | } 39 | 40 | /** 41 | * @test 42 | */ 43 | public function testCreate() 44 | { 45 | $router = new \Upwork\API\Routers\Hr\Milestones($this->_client); 46 | $response = $router->create(array()); 47 | 48 | $this->_checkResponse($response); 49 | } 50 | 51 | /** 52 | * @test 53 | */ 54 | public function testEdit() 55 | { 56 | $router = new \Upwork\API\Routers\Hr\Milestones($this->_client); 57 | $response = $router->edit('1234', array()); 58 | 59 | $this->_checkResponse($response); 60 | } 61 | 62 | /** 63 | * @test 64 | */ 65 | public function testActivate() 66 | { 67 | $router = new \Upwork\API\Routers\Hr\Milestones($this->_client); 68 | $response = $router->activate('1234', array()); 69 | 70 | $this->_checkResponse($response); 71 | } 72 | 73 | /** 74 | * @test 75 | */ 76 | public function testApprove() 77 | { 78 | $router = new \Upwork\API\Routers\Hr\Milestones($this->_client); 79 | $response = $router->approve('1234', array()); 80 | 81 | $this->_checkResponse($response); 82 | } 83 | 84 | /** 85 | * @test 86 | */ 87 | public function testDelete() 88 | { 89 | $router = new \Upwork\API\Routers\Hr\Milestones($this->_client); 90 | $response = $router->deleteMilestone('1234'); 91 | 92 | $this->_checkResponse($response); 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /tests/Upwork/API/Routers/Hr/RolesTest.php: -------------------------------------------------------------------------------- 1 | _client); 24 | $response = $router->getAll(); 25 | 26 | $this->_checkResponse($response); 27 | } 28 | 29 | /** 30 | * @test 31 | */ 32 | public function testGetBySpecificUser() 33 | { 34 | $router = new \Upwork\API\Routers\Hr\Roles($this->_client); 35 | $response = $router->getBySpecificUser('12345'); 36 | 37 | $this->_checkResponse($response); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /tests/Upwork/API/Routers/Hr/SubmissionsTest.php: -------------------------------------------------------------------------------- 1 | _client); 24 | $response = $router->requestApproval(array()); 25 | 26 | $this->_checkResponse($response); 27 | } 28 | 29 | /** 30 | * @test 31 | */ 32 | public function testApprove() 33 | { 34 | $router = new \Upwork\API\Routers\Hr\Submissions($this->_client); 35 | $response = $router->approve('1234', array()); 36 | 37 | $this->_checkResponse($response); 38 | } 39 | 40 | /** 41 | * @test 42 | */ 43 | public function testReject() 44 | { 45 | $router = new \Upwork\API\Routers\Hr\Submissions($this->_client); 46 | $response = $router->reject('1234', array()); 47 | 48 | $this->_checkResponse($response); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /tests/Upwork/API/Routers/Jobs/ProfileTest.php: -------------------------------------------------------------------------------- 1 | _client); 24 | $response = $router->getSpecific('~profilekey'); 25 | 26 | $this->_checkResponse($response); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /tests/Upwork/API/Routers/Jobs/SearchTest.php: -------------------------------------------------------------------------------- 1 | _client); 24 | $response = $router->find(array()); 25 | 26 | $this->_checkResponse($response); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /tests/Upwork/API/Routers/MetadataTest.php: -------------------------------------------------------------------------------- 1 | _client); 22 | $response = $router->getCategoriesV2(); 23 | 24 | $this->_checkResponse($response); 25 | } 26 | 27 | /** 28 | * @test 29 | */ 30 | public function testGetSkills() 31 | { 32 | $router = new \Upwork\API\Routers\Metadata($this->_client); 33 | $response = $router->getSkills(); 34 | 35 | $this->_checkResponse($response); 36 | } 37 | 38 | /** 39 | * @test 40 | */ 41 | public function testGetSkillsV2() 42 | { 43 | $router = new \Upwork\API\Routers\Metadata($this->_client); 44 | $response = $router->getSkillsV2(); 45 | 46 | $this->_checkResponse($response); 47 | } 48 | 49 | /** 50 | * @test 51 | */ 52 | public function testGetSpecialties() 53 | { 54 | $router = new \Upwork\API\Routers\Metadata($this->_client); 55 | $response = $router->getSpecialties(); 56 | 57 | $this->_checkResponse($response); 58 | } 59 | 60 | /** 61 | * @test 62 | */ 63 | public function testGetRegions() 64 | { 65 | $router = new \Upwork\API\Routers\Metadata($this->_client); 66 | $response = $router->getRegions(); 67 | 68 | $this->_checkResponse($response); 69 | } 70 | 71 | /** 72 | * @test 73 | */ 74 | public function testGetTests() 75 | { 76 | $router = new \Upwork\API\Routers\Metadata($this->_client); 77 | $response = $router->getTests(); 78 | 79 | $this->_checkResponse($response); 80 | } 81 | 82 | /** 83 | * @test 84 | */ 85 | public function testGetReasons() 86 | { 87 | $router = new \Upwork\API\Routers\Metadata($this->_client); 88 | $response = $router->getReasons(array()); 89 | 90 | $this->_checkResponse($response); 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /tests/Upwork/API/Routers/Organization/CompaniesTest.php: -------------------------------------------------------------------------------- 1 | _client); 24 | $response = $router->getList(); 25 | 26 | $this->_checkResponse($response); 27 | } 28 | 29 | /** 30 | * @test 31 | */ 32 | public function testGetSpecific() 33 | { 34 | $router = new \Upwork\API\Routers\Organization\Companies($this->_client); 35 | $response = $router->getSpecific('12345'); 36 | 37 | $this->_checkResponse($response); 38 | } 39 | 40 | /** 41 | * @test 42 | */ 43 | public function testGetTeams() 44 | { 45 | $router = new \Upwork\API\Routers\Organization\Companies($this->_client); 46 | $response = $router->getTeams('12345'); 47 | 48 | $this->_checkResponse($response); 49 | } 50 | 51 | /** 52 | * @test 53 | */ 54 | public function testUsers() 55 | { 56 | $router = new \Upwork\API\Routers\Organization\Companies($this->_client); 57 | $response = $router->getUsers('12345'); 58 | 59 | $this->_checkResponse($response); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /tests/Upwork/API/Routers/Organization/TeamsTest.php: -------------------------------------------------------------------------------- 1 | _client); 24 | $response = $router->getList(); 25 | 26 | $this->_checkResponse($response); 27 | } 28 | 29 | /** 30 | * @test 31 | */ 32 | public function testGetUsersInTeam() 33 | { 34 | $router = new \Upwork\API\Routers\Organization\Teams($this->_client); 35 | $response = $router->getUsersInTeam('12345'); 36 | 37 | $this->_checkResponse($response); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /tests/Upwork/API/Routers/Organization/UsersTest.php: -------------------------------------------------------------------------------- 1 | _client); 24 | $response = $router->getMyInfo(); 25 | 26 | $this->_checkResponse($response); 27 | } 28 | 29 | /** 30 | * @test 31 | */ 32 | public function testSpecific() 33 | { 34 | $router = new \Upwork\API\Routers\Organization\Users($this->_client); 35 | $response = $router->getSpecific('1234'); 36 | 37 | $this->_checkResponse($response); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /tests/Upwork/API/Routers/PaymentsTest.php: -------------------------------------------------------------------------------- 1 | _client); 22 | $response = $router->submitBonus('12345', array()); 23 | 24 | $this->_checkResponse($response); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /tests/Upwork/API/Routers/Reports/Finance/AccountsTest.php: -------------------------------------------------------------------------------- 1 | _client); 24 | $response = $router->getSpecific('12345', array()); 25 | 26 | $this->_checkResponse($response); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /tests/Upwork/API/Routers/Reports/Finance/BillingsTest.php: -------------------------------------------------------------------------------- 1 | _client); 24 | $response = $router->getByFreelancer('12345', array()); 25 | 26 | $this->_checkResponse($response); 27 | } 28 | 29 | /** 30 | * @test 31 | */ 32 | public function testGetByBuyersTeam() 33 | { 34 | $router = new \Upwork\API\Routers\Reports\Finance\Billings($this->_client); 35 | $response = $router->getByBuyersTeam('12345', array()); 36 | 37 | $this->_checkResponse($response); 38 | } 39 | 40 | /** 41 | * @test 42 | */ 43 | public function testGetByBuyersCompany() 44 | { 45 | $router = new \Upwork\API\Routers\Reports\Finance\Billings($this->_client); 46 | $response = $router->getByBuyersCompany('12345', array()); 47 | 48 | $this->_checkResponse($response); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /tests/Upwork/API/Routers/Reports/Finance/EarningsTest.php: -------------------------------------------------------------------------------- 1 | _client); 24 | $response = $router->getByFreelancer('12345', array()); 25 | 26 | $this->_checkResponse($response); 27 | } 28 | 29 | /** 30 | * @test 31 | */ 32 | public function testGetByBuyersTeam() 33 | { 34 | $router = new \Upwork\API\Routers\Reports\Finance\Earnings($this->_client); 35 | $response = $router->getByBuyersTeam('12345', array()); 36 | 37 | $this->_checkResponse($response); 38 | } 39 | 40 | /** 41 | * @test 42 | */ 43 | public function testGetByBuyersCompany() 44 | { 45 | $router = new \Upwork\API\Routers\Reports\Finance\Earnings($this->_client); 46 | $response = $router->getByBuyersCompany('12345', array()); 47 | 48 | $this->_checkResponse($response); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /tests/Upwork/API/Routers/Reports/TimeTest.php: -------------------------------------------------------------------------------- 1 | _client); 24 | $response = $router->getByTeamFull('company', 'team', array()); 25 | 26 | $this->_checkResponse($response); 27 | } 28 | 29 | /** 30 | * @test 31 | */ 32 | public function testGetByTeamLimited() 33 | { 34 | $router = new \Upwork\API\Routers\Reports\Time($this->_client); 35 | $response = $router->getByTeamLimited('company', 'team', array()); 36 | 37 | $this->_checkResponse($response); 38 | } 39 | 40 | /** 41 | * @test 42 | */ 43 | public function testGetByAgency() 44 | { 45 | $router = new \Upwork\API\Routers\Reports\Time($this->_client); 46 | $response = $router->getByAgency('company', 'agency', array()); 47 | 48 | $this->_checkResponse($response); 49 | } 50 | 51 | /** 52 | * @test 53 | */ 54 | public function testGetByCompany() 55 | { 56 | $router = new \Upwork\API\Routers\Reports\Time($this->_client); 57 | $response = $router->getByCompany('company', array()); 58 | 59 | $this->_checkResponse($response); 60 | } 61 | 62 | /** 63 | * @test 64 | */ 65 | public function testGetByFreelancerLimited() 66 | { 67 | $router = new \Upwork\API\Routers\Reports\Time($this->_client); 68 | $response = $router->getByFreelancerLimited('provider', array()); 69 | 70 | $this->_checkResponse($response); 71 | } 72 | 73 | /** 74 | * @test 75 | */ 76 | public function testGetByFreelancerFull() 77 | { 78 | $router = new \Upwork\API\Routers\Reports\Time($this->_client); 79 | $response = $router->getByFreelancerFull('provider', array()); 80 | 81 | $this->_checkResponse($response); 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /tests/Upwork/API/Routers/SnapshotTest.php: -------------------------------------------------------------------------------- 1 | _client); 22 | $response = $router->getByContract('1234', '1234567890'); 23 | 24 | $this->_checkResponse($response); 25 | } 26 | 27 | /** 28 | * @test 29 | */ 30 | public function testUpdateByContract() 31 | { 32 | $router = new \Upwork\API\Routers\Snapshot($this->_client); 33 | $response = $router->updateByContract('1234', '1234567890', array()); 34 | 35 | $this->_checkResponse($response); 36 | } 37 | 38 | /** 39 | * @test 40 | */ 41 | public function testDeleteByContract() 42 | { 43 | $router = new \Upwork\API\Routers\Snapshot($this->_client); 44 | $response = $router->deleteByContract('1234', '1234567890'); 45 | 46 | $this->_checkResponse($response); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /tests/Upwork/API/Routers/WorkdaysTest.php: -------------------------------------------------------------------------------- 1 | _client); 22 | $response = $router->getByCompany('company', '20140101', '20140131', array()); 23 | 24 | $this->_checkResponse($response); 25 | } 26 | 27 | /** 28 | * @test 29 | */ 30 | public function testGetByContract() 31 | { 32 | $router = new \Upwork\API\Routers\Workdays($this->_client); 33 | $response = $router->getByContract('1234', '20140101', '20140131', array()); 34 | 35 | $this->_checkResponse($response); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /tests/Upwork/API/Routers/WorkdiaryTest.php: -------------------------------------------------------------------------------- 1 | _client); 22 | $response = $router->getByCompany('company', '20140101', array()); 23 | 24 | $this->_checkResponse($response); 25 | } 26 | 27 | /** 28 | * @test 29 | */ 30 | public function testGetByContract() 31 | { 32 | $router = new \Upwork\API\Routers\Workdiary($this->_client); 33 | $response = $router->getByContract('1234', '20140101', array()); 34 | 35 | $this->_checkResponse($response); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /tests/Upwork/API/UtilsTest.php: -------------------------------------------------------------------------------- 1 | assertEquals('https://www.upwork.com/api/auth/v1/oauth/token/access', $url); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /vendor-src/README: -------------------------------------------------------------------------------- 1 | * This directory contains sources non-related to Upwork php code, like php-oauth library from https://code.google.com/p/oauth-php/. 2 | * See usage, license(s) and copyright(s) of this/these source(s) under proper location. 3 | * This/these source(s) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND" 4 | -------------------------------------------------------------------------------- /vendor-src/oauth-php/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2007-2009 Mediamatic Lab 4 | Copyright (c) 2010 Corollarium Technologies 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. -------------------------------------------------------------------------------- /vendor-src/oauth-php/README: -------------------------------------------------------------------------------- 1 | Please see http://code.google.com/p/oauth-php/ for documentation and help. 2 | -------------------------------------------------------------------------------- /vendor-src/oauth-php/example/client/twolegged.php: -------------------------------------------------------------------------------- 1 | $key, 'consumer_secret' => $secret); 44 | OAuthStore::instance("2Leg", $options); 45 | 46 | $method = "GET"; 47 | $params = null; 48 | 49 | try 50 | { 51 | // Obtain a request object for the request we want to make 52 | $request = new OAuthRequester($url, $method, $params); 53 | 54 | // Sign the request, perform a curl request and return the results, 55 | // throws OAuthException2 exception on an error 56 | // $result is an array of the form: array ('code'=>int, 'headers'=>array(), 'body'=>string) 57 | $result = $request->doRequest(); 58 | 59 | $response = $result['body']; 60 | var_dump($response); 61 | } 62 | catch(OAuthException2 $e) 63 | { 64 | echo "Exception"; 65 | } 66 | 67 | ?> 68 | -------------------------------------------------------------------------------- /vendor-src/oauth-php/example/client/twoleggedtest.php: -------------------------------------------------------------------------------- 1 | $key, 'consumer_secret' => $secret); 45 | OAuthStore::instance("2Leg", $options); 46 | 47 | $method = "GET"; 48 | $params = null; 49 | 50 | try 51 | { 52 | // Obtain a request object for the request we want to make 53 | $request = new OAuthRequester($url, $method, $params); 54 | 55 | // Sign the request, perform a curl request and return the results, 56 | // throws OAuthException2 exception on an error 57 | // $result is an array of the form: array ('code'=>int, 'headers'=>array(), 'body'=>string) 58 | $result = $request->doRequest(); 59 | 60 | $response = $result['body']; 61 | 62 | if ($response != 'oauth_token=requestkey&oauth_token_secret=requestsecret') 63 | { 64 | echo 'Error! $response ' . $response; 65 | } 66 | else 67 | { 68 | } 69 | 70 | 71 | var_dump($response); 72 | } 73 | catch(OAuthException2 $e) 74 | { 75 | echo "Exception" . $e->getMessage(); 76 | } 77 | 78 | ?> 79 | -------------------------------------------------------------------------------- /vendor-src/oauth-php/example/client/twoleggedtwitter.php: -------------------------------------------------------------------------------- 1 | TWITTER_CONSUMER_KEY, 'consumer_secret' => TWITTER_CONSUMER_SECRET); 49 | OAuthStore::instance("2Leg", $options); 50 | 51 | try 52 | { 53 | // Obtain a request object for the request we want to make 54 | $request = new OAuthRequester(TWITTER_REQUEST_TOKEN_URL, "POST"); 55 | $result = $request->doRequest(0); 56 | parse_str($result['body'], $params); 57 | 58 | echo "aa"; 59 | 60 | // now make the request. 61 | $request = new OAuthRequester(TWITTER_PUBLIC_TIMELINE_API, 'GET', $params); 62 | $result = $request->doRequest(); 63 | } 64 | catch(OAuthException2 $e) 65 | { 66 | echo "Exception" . $e->getMessage(); 67 | } 68 | 69 | ?> -------------------------------------------------------------------------------- /vendor-src/oauth-php/example/server/INSTALL: -------------------------------------------------------------------------------- 1 | In this example I assume that oauth-php lives in /home/john/src/oauth-php 2 | 3 | 4 | 1) Create a virtual host and set the DB_DSN VARIABLE to the DSN of your (mysql) database. 5 | 6 | Example 7 | 8 | ServerAdmin admin@localhost 9 | ServerName hello.local 10 | DocumentRoot /home/john/src/oauth-php/example/server/www 11 | 12 | UseCanonicalName Off 13 | ServerSignature On 14 | 15 | SetEnv DB_DSN mysql://foo:bar@localhost/oauth_example_server_db 16 | 17 | 18 | Options Indexes FollowSymLinks MultiViews 19 | AllowOverride None 20 | Order allow,deny 21 | Allow from all 22 | 23 | 24 | php_value magic_quotes_gpc 0 25 | php_value register_globals 0 26 | php_value session.auto_start 0 27 | 28 | 29 | 30 | 31 | 32 | 33 | 2) Create the database structure for the server: 34 | 35 | # mysql -u foo -p bar -h localhost < /home/john/src/oauth-php/library/store/mysql/mysql.sql 36 | 37 | 38 | 39 | 3) Download and install smarty into the smarty/core/smarty directory: 40 | 41 | # cd /home/john/src/oauth-php/example/server/core 42 | # wget 'http://www.smarty.net/do_download.php?download_file=Smarty-2.6.19.tar.gz' 43 | # tar zxf Smarty-2.6.19.tar.gz 44 | # mv Smarty-2.6.19 smarty 45 | 46 | 47 | 4) That's it! Point your browser to 48 | 49 | http://hello.local/ 50 | 51 | To get started. 52 | 53 | Arjan Scherpenisse , July 2008 54 | -------------------------------------------------------------------------------- /vendor-src/oauth-php/example/server/core/templates/inc/footer.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /vendor-src/oauth-php/example/server/core/templates/inc/header.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /vendor-src/oauth-php/example/server/core/templates/index.tpl: -------------------------------------------------------------------------------- 1 | {include file='inc/header.tpl'} 2 | 3 |

OAuth server

4 | Go to: 5 | 6 | 10 | 11 | Afterwards, make an OAuth test request to http://{$smarty.server.name}/hello to test your connection.

12 | 13 | {include file='inc/footer.tpl'} 14 | -------------------------------------------------------------------------------- /vendor-src/oauth-php/example/server/core/templates/logon.tpl: -------------------------------------------------------------------------------- 1 | {include file='inc/header.tpl'} 2 | 3 |

Login

4 | 5 |
6 | 7 | 8 |
9 | 10 | 11 |

12 | 13 |
14 | 15 | 16 |

17 | 18 | 19 |
20 | 21 | {include file='inc/footer.tpl'} 22 | -------------------------------------------------------------------------------- /vendor-src/oauth-php/example/server/core/templates/register.tpl: -------------------------------------------------------------------------------- 1 | {include file='inc/header.tpl'} 2 | 3 |

Register server

4 | 5 |

Register a server which is gonna act as an identity client.

6 | 7 |
8 | 9 |
10 | About You 11 | 12 |

13 |
14 | 15 |

16 | 17 |

18 |
19 | 20 |

21 |
22 | 23 |
24 | Location Of Your Application Or Site 25 | 26 |

27 |
28 | 29 |

30 | 31 |

32 |
33 | 34 |

35 |
36 | 37 |
38 | 39 |
40 | 41 | {include file='inc/footer.tpl'} 42 | -------------------------------------------------------------------------------- /vendor-src/oauth-php/example/server/www/hello.php: -------------------------------------------------------------------------------- 1 | 11 | * 12 | * 13 | * The MIT License 14 | * 15 | * Copyright (c) 2007-2008 Mediamatic Lab 16 | * 17 | * Permission is hereby granted, free of charge, to any person obtaining a copy 18 | * of this software and associated documentation files (the "Software"), to deal 19 | * in the Software without restriction, including without limitation the rights 20 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 21 | * copies of the Software, and to permit persons to whom the Software is 22 | * furnished to do so, subject to the following conditions: 23 | * 24 | * The above copyright notice and this permission notice shall be included in 25 | * all copies or substantial portions of the Software. 26 | * 27 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 28 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 29 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 30 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 31 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 32 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 33 | * THE SOFTWARE. 34 | */ 35 | 36 | require_once '../core/init.php'; 37 | 38 | $authorized = false; 39 | $server = new OAuthServer(); 40 | try 41 | { 42 | if ($server->verifyIfSigned()) 43 | { 44 | $authorized = true; 45 | } 46 | } 47 | catch (OAuthException2 $e) 48 | { 49 | } 50 | 51 | if (!$authorized) 52 | { 53 | header('HTTP/1.1 401 Unauthorized'); 54 | header('Content-Type: text/plain'); 55 | 56 | echo "OAuth Verification Failed: " . $e->getMessage(); 57 | die; 58 | } 59 | 60 | // From here on we are authenticated with OAuth. 61 | 62 | header('Content-type: text/plain'); 63 | echo 'Hello, world!'; 64 | 65 | ?> -------------------------------------------------------------------------------- /vendor-src/oauth-php/example/server/www/index.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * 9 | * The MIT License 10 | * 11 | * Copyright (c) 2007-2008 Mediamatic Lab 12 | * 13 | * Permission is hereby granted, free of charge, to any person obtaining a copy 14 | * of this software and associated documentation files (the "Software"), to deal 15 | * in the Software without restriction, including without limitation the rights 16 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 17 | * copies of the Software, and to permit persons to whom the Software is 18 | * furnished to do so, subject to the following conditions: 19 | * 20 | * The above copyright notice and this permission notice shall be included in 21 | * all copies or substantial portions of the Software. 22 | * 23 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 24 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 26 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 27 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 28 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 29 | * THE SOFTWARE. 30 | */ 31 | 32 | require '../core/init.php'; 33 | 34 | $smarty = session_smarty(); 35 | $smarty->display('index.tpl'); 36 | 37 | ?> 38 | -------------------------------------------------------------------------------- /vendor-src/oauth-php/example/server/www/logon.php: -------------------------------------------------------------------------------- 1 | 9 | * 10 | * 11 | * The MIT License 12 | * 13 | * Copyright (c) 2007-2008 Mediamatic Lab 14 | * 15 | * Permission is hereby granted, free of charge, to any person obtaining a copy 16 | * of this software and associated documentation files (the "Software"), to deal 17 | * in the Software without restriction, including without limitation the rights 18 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | * copies of the Software, and to permit persons to whom the Software is 20 | * furnished to do so, subject to the following conditions: 21 | * 22 | * The above copyright notice and this permission notice shall be included in 23 | * all copies or substantial portions of the Software. 24 | * 25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 31 | * THE SOFTWARE. 32 | */ 33 | 34 | require_once '../core/init.php'; 35 | 36 | if (isset($_POST['username']) && isset($_POST['password'])) 37 | { 38 | if ($_POST['username'] == USERNAME && $_POST['password'] == PASSWORD) 39 | { 40 | $_SESSION['authorized'] = true; 41 | if (!empty($_REQUEST['goto'])) 42 | { 43 | header('Location: ' . $_REQUEST['goto']); 44 | die; 45 | } 46 | 47 | echo "Logon succesfull."; 48 | die; 49 | } 50 | } 51 | 52 | $smarty = session_smarty(); 53 | $smarty->display('logon.tpl'); 54 | 55 | ?> -------------------------------------------------------------------------------- /vendor-src/oauth-php/example/server/www/oauth.php: -------------------------------------------------------------------------------- 1 | 12 | * 13 | * 14 | * The MIT License 15 | * 16 | * Copyright (c) 2007-2008 Mediamatic Lab 17 | * 18 | * Permission is hereby granted, free of charge, to any person obtaining a copy 19 | * of this software and associated documentation files (the "Software"), to deal 20 | * in the Software without restriction, including without limitation the rights 21 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 22 | * copies of the Software, and to permit persons to whom the Software is 23 | * furnished to do so, subject to the following conditions: 24 | * 25 | * The above copyright notice and this permission notice shall be included in 26 | * all copies or substantial portions of the Software. 27 | * 28 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 29 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 30 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 31 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 32 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 33 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 34 | * THE SOFTWARE. 35 | */ 36 | 37 | require_once '../core/init.php'; 38 | 39 | $server = new OAuthServer(); 40 | 41 | switch($_SERVER['PATH_INFO']) 42 | { 43 | case '/request_token': 44 | $server->requestToken(); 45 | exit; 46 | 47 | case '/access_token': 48 | $server->accessToken(); 49 | exit; 50 | 51 | case '/authorize': 52 | # logon 53 | 54 | assert_logged_in(); 55 | 56 | try 57 | { 58 | $server->authorizeVerify(); 59 | $server->authorizeFinish(true, 1); 60 | } 61 | catch (OAuthException2 $e) 62 | { 63 | header('HTTP/1.1 400 Bad Request'); 64 | header('Content-Type: text/plain'); 65 | 66 | echo "Failed OAuth Request: " . $e->getMessage(); 67 | } 68 | exit; 69 | 70 | 71 | default: 72 | header('HTTP/1.1 500 Internal Server Error'); 73 | header('Content-Type: text/plain'); 74 | echo "Unknown request"; 75 | } 76 | 77 | ?> -------------------------------------------------------------------------------- /vendor-src/oauth-php/example/server/www/register.php: -------------------------------------------------------------------------------- 1 | updateConsumer($_POST, $user_id, true); 14 | 15 | $c = $store->getConsumer($key, $user_id); 16 | echo 'Your consumer key is: ' . $c['consumer_key'] . '
'; 17 | echo 'Your consumer secret is: ' . $c['consumer_secret'] . '
'; 18 | } 19 | catch (OAuthException2 $e) 20 | { 21 | echo 'Error: ' . $e->getMessage() . '
'; 22 | } 23 | } 24 | 25 | 26 | $smarty = session_smarty(); 27 | $smarty->display('register.tpl'); 28 | 29 | ?> -------------------------------------------------------------------------------- /vendor-src/oauth-php/example/server/www/services.xrds.php: -------------------------------------------------------------------------------- 1 | 10 | * 11 | * 12 | * The MIT License 13 | * 14 | * Copyright (c) 2007-2008 Mediamatic Lab 15 | * 16 | * Permission is hereby granted, free of charge, to any person obtaining a copy 17 | * of this software and associated documentation files (the "Software"), to deal 18 | * in the Software without restriction, including without limitation the rights 19 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 20 | * copies of the Software, and to permit persons to whom the Software is 21 | * furnished to do so, subject to the following conditions: 22 | * 23 | * The above copyright notice and this permission notice shall be included in 24 | * all copies or substantial portions of the Software. 25 | * 26 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 27 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 28 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 29 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 30 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 31 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 32 | * THE SOFTWARE. 33 | */ 34 | 35 | header('Content-Type: application/xrds+xml'); 36 | 37 | $server = $_SERVER['SERVER_NAME']; 38 | 39 | echo '' . "\n"; 40 | 41 | ?> 42 | 43 | 44 | xri://$xrds*simple 45 | 46 | http://oauth.net/discovery/1.0 47 | #main 48 | 49 | 50 | http://oauth.net/core/1.0/endpoint/request 51 | http://oauth.net/core/1.0/parameters/auth-header 52 | http://oauth.net/core/1.0/parameters/uri-query 53 | http://oauth.net/core/1.0/signature/HMAC-SHA1 54 | http://oauth.net/core/1.0/signature/PLAINTEXT 55 | http:///oauth/request_token 56 | 57 | 58 | http://oauth.net/core/1.0/endpoint/authorize 59 | http://oauth.net/core/1.0/parameters/uri-query 60 | http:///oauth/authorize 61 | 62 | 63 | http://oauth.net/core/1.0/endpoint/access 64 | http://oauth.net/core/1.0/parameters/auth-header 65 | http://oauth.net/core/1.0/parameters/uri-query 66 | http://oauth.net/core/1.0/signature/HMAC-SHA1 67 | http://oauth.net/core/1.0/signature/PLAINTEXT 68 | http:///oauth/access_token 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /vendor-src/oauth-php/library/OAuthException2.php: -------------------------------------------------------------------------------- 1 | 8 | * @date Nov 29, 2007 5:33:54 PM 9 | * 10 | * The MIT License 11 | * 12 | * Copyright (c) 2007-2008 Mediamatic Lab 13 | * 14 | * Permission is hereby granted, free of charge, to any person obtaining a copy 15 | * of this software and associated documentation files (the "Software"), to deal 16 | * in the Software without restriction, including without limitation the rights 17 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 18 | * copies of the Software, and to permit persons to whom the Software is 19 | * furnished to do so, subject to the following conditions: 20 | * 21 | * The above copyright notice and this permission notice shall be included in 22 | * all copies or substantial portions of the Software. 23 | * 24 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 25 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 26 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 27 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 28 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 29 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 30 | * THE SOFTWARE. 31 | */ 32 | 33 | // TODO: something with the HTTP return code matching to the problem 34 | 35 | require_once dirname(__FILE__) . '/OAuthRequestLogger.php'; 36 | 37 | class OAuthException2 extends Exception 38 | { 39 | function __construct ( $message ) 40 | { 41 | Exception::__construct($message); 42 | OAuthRequestLogger::addNote('OAuthException2: '.$message); 43 | } 44 | 45 | } 46 | 47 | 48 | /* vi:set ts=4 sts=4 sw=4 binary noeol: */ 49 | 50 | ?> -------------------------------------------------------------------------------- /vendor-src/oauth-php/library/OAuthSession.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /vendor-src/oauth-php/library/OAuthStore.php: -------------------------------------------------------------------------------- 1 | 9 | * @date Nov 16, 2007 4:03:30 PM 10 | * 11 | * 12 | * The MIT License 13 | * 14 | * Copyright (c) 2007-2008 Mediamatic Lab 15 | * 16 | * Permission is hereby granted, free of charge, to any person obtaining a copy 17 | * of this software and associated documentation files (the "Software"), to deal 18 | * in the Software without restriction, including without limitation the rights 19 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 20 | * copies of the Software, and to permit persons to whom the Software is 21 | * furnished to do so, subject to the following conditions: 22 | * 23 | * The above copyright notice and this permission notice shall be included in 24 | * all copies or substantial portions of the Software. 25 | * 26 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 27 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 28 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 29 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 30 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 31 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 32 | * THE SOFTWARE. 33 | */ 34 | 35 | require_once dirname(__FILE__) . '/OAuthException2.php'; 36 | 37 | class OAuthStore 38 | { 39 | static private $instance = false; 40 | 41 | /** 42 | * Request an instance of the OAuthStore 43 | */ 44 | public static function instance ( $store = 'MySQL', $options = array() ) 45 | { 46 | if (!OAuthStore::$instance) 47 | { 48 | // Select the store you want to use 49 | if (strpos($store, '/') === false) 50 | { 51 | $class = 'OAuthStore'.$store; 52 | $file = dirname(__FILE__) . '/store/'.$class.'.php'; 53 | } 54 | else 55 | { 56 | $file = $store; 57 | $store = basename($file, '.php'); 58 | $class = $store; 59 | } 60 | 61 | if (is_file($file)) 62 | { 63 | require_once $file; 64 | 65 | if (class_exists($class)) 66 | { 67 | OAuthStore::$instance = new $class($options); 68 | } 69 | else 70 | { 71 | throw new OAuthException2('Could not find class '.$class.' in file '.$file); 72 | } 73 | } 74 | else 75 | { 76 | throw new OAuthException2('No OAuthStore for '.$store.' (file '.$file.')'); 77 | } 78 | } 79 | return OAuthStore::$instance; 80 | } 81 | } 82 | 83 | 84 | /* vi:set ts=4 sts=4 sw=4 binary noeol: */ 85 | 86 | ?> -------------------------------------------------------------------------------- /vendor-src/oauth-php/library/session/OAuthSessionAbstract.class.php: -------------------------------------------------------------------------------- 1 | 8 | * 9 | * The MIT License 10 | * 11 | * Copyright (c) 2010 Corollarium Technologies 12 | * 13 | * Permission is hereby granted, free of charge, to any person obtaining a copy 14 | * of this software and associated documentation files (the "Software"), to deal 15 | * in the Software without restriction, including without limitation the rights 16 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 17 | * copies of the Software, and to permit persons to whom the Software is 18 | * furnished to do so, subject to the following conditions: 19 | * 20 | * The above copyright notice and this permission notice shall be included in 21 | * all copies or substantial portions of the Software. 22 | * 23 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 24 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 26 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 27 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 28 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 29 | * THE SOFTWARE. 30 | */ 31 | 32 | /** 33 | * This class is used to store Session information on the server. Most 34 | * people will use the $_SESSION based implementation, but you may prefer 35 | * a SQL, Memcache or other implementation. 36 | * 37 | */ 38 | abstract class OAuthSessionAbstract 39 | { 40 | abstract public function get ( $key ); 41 | abstract public function set ( $key, $data ); 42 | } 43 | 44 | ?> -------------------------------------------------------------------------------- /vendor-src/oauth-php/library/session/OAuthSessionSESSION.php: -------------------------------------------------------------------------------- 1 | 8 | * 9 | * The MIT License 10 | * 11 | * Copyright (c) 2010 Corollarium Technologies 12 | * 13 | * Permission is hereby granted, free of charge, to any person obtaining a copy 14 | * of this software and associated documentation files (the "Software"), to deal 15 | * in the Software without restriction, including without limitation the rights 16 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 17 | * copies of the Software, and to permit persons to whom the Software is 18 | * furnished to do so, subject to the following conditions: 19 | * 20 | * The above copyright notice and this permission notice shall be included in 21 | * all copies or substantial portions of the Software. 22 | * 23 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 24 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 26 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 27 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 28 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 29 | * THE SOFTWARE. 30 | */ 31 | 32 | require_once dirname(__FILE__) . '/OAuthSessionAbstract.class.php'; 33 | 34 | class OAuthSessionSESSION extends OAuthSessionAbstract 35 | { 36 | public function __construct( $options = array() ) 37 | { 38 | } 39 | 40 | /** 41 | * Gets a variable value 42 | * 43 | * @param string $key 44 | * @return The value or null if not set. 45 | */ 46 | public function get ( $key ) 47 | { 48 | return @$_SESSION[$key]; 49 | } 50 | 51 | /** 52 | * Sets a variable value 53 | * 54 | * @param string $key The key 55 | * @param any $data The data 56 | */ 57 | public function set ( $key, $data ) 58 | { 59 | $_SESSION[$key] = $data; 60 | } 61 | } 62 | 63 | ?> -------------------------------------------------------------------------------- /vendor-src/oauth-php/library/signature_method/OAuthSignatureMethod.class.php: -------------------------------------------------------------------------------- 1 | 8 | * @date Sep 8, 2008 12:04:35 PM 9 | * 10 | * The MIT License 11 | * 12 | * Copyright (c) 2007-2008 Mediamatic Lab 13 | * 14 | * Permission is hereby granted, free of charge, to any person obtaining a copy 15 | * of this software and associated documentation files (the "Software"), to deal 16 | * in the Software without restriction, including without limitation the rights 17 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 18 | * copies of the Software, and to permit persons to whom the Software is 19 | * furnished to do so, subject to the following conditions: 20 | * 21 | * The above copyright notice and this permission notice shall be included in 22 | * all copies or substantial portions of the Software. 23 | * 24 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 25 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 26 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 27 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 28 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 29 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 30 | * THE SOFTWARE. 31 | */ 32 | 33 | abstract class OAuthSignatureMethod 34 | { 35 | /** 36 | * Return the name of this signature 37 | * 38 | * @return string 39 | */ 40 | abstract public function name(); 41 | 42 | /** 43 | * Return the signature for the given request 44 | * 45 | * @param OAuthRequest request 46 | * @param string base_string 47 | * @param string consumer_secret 48 | * @param string token_secret 49 | * @return string 50 | */ 51 | abstract public function signature ( $request, $base_string, $consumer_secret, $token_secret ); 52 | 53 | /** 54 | * Check if the request signature corresponds to the one calculated for the request. 55 | * 56 | * @param OAuthRequest request 57 | * @param string base_string data to be signed, usually the base string, can be a request body 58 | * @param string consumer_secret 59 | * @param string token_secret 60 | * @param string signature from the request, still urlencoded 61 | * @return string 62 | */ 63 | abstract public function verify ( $request, $base_string, $consumer_secret, $token_secret, $signature ); 64 | } 65 | 66 | 67 | /* vi:set ts=4 sts=4 sw=4 binary noeol: */ 68 | 69 | ?> -------------------------------------------------------------------------------- /vendor-src/oauth-php/library/signature_method/OAuthSignatureMethod_PLAINTEXT.php: -------------------------------------------------------------------------------- 1 | 8 | * @date Sep 8, 2008 12:09:43 PM 9 | * 10 | * The MIT License 11 | * 12 | * Copyright (c) 2007-2008 Mediamatic Lab 13 | * 14 | * Permission is hereby granted, free of charge, to any person obtaining a copy 15 | * of this software and associated documentation files (the "Software"), to deal 16 | * in the Software without restriction, including without limitation the rights 17 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 18 | * copies of the Software, and to permit persons to whom the Software is 19 | * furnished to do so, subject to the following conditions: 20 | * 21 | * The above copyright notice and this permission notice shall be included in 22 | * all copies or substantial portions of the Software. 23 | * 24 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 25 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 26 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 27 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 28 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 29 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 30 | * THE SOFTWARE. 31 | */ 32 | 33 | require_once dirname(__FILE__).'/OAuthSignatureMethod.class.php'; 34 | 35 | 36 | class OAuthSignatureMethod_PLAINTEXT extends OAuthSignatureMethod 37 | { 38 | public function name () 39 | { 40 | return 'PLAINTEXT'; 41 | } 42 | 43 | 44 | /** 45 | * Calculate the signature using PLAINTEXT 46 | * 47 | * @param OAuthRequest request 48 | * @param string base_string 49 | * @param string consumer_secret 50 | * @param string token_secret 51 | * @return string 52 | */ 53 | function signature ( $request, $base_string, $consumer_secret, $token_secret ) 54 | { 55 | return $request->urlencode($request->urlencode($consumer_secret).'&'.$request->urlencode($token_secret)); 56 | } 57 | 58 | 59 | /** 60 | * Check if the request signature corresponds to the one calculated for the request. 61 | * 62 | * @param OAuthRequest request 63 | * @param string base_string data to be signed, usually the base string, can be a request body 64 | * @param string consumer_secret 65 | * @param string token_secret 66 | * @param string signature from the request, still urlencoded 67 | * @return string 68 | */ 69 | public function verify ( $request, $base_string, $consumer_secret, $token_secret, $signature ) 70 | { 71 | $a = $request->urldecode($signature); 72 | $b = $request->urldecode($this->signature($request, $base_string, $consumer_secret, $token_secret)); 73 | 74 | return $request->urldecode($a) == $request->urldecode($b); 75 | } 76 | } 77 | 78 | /* vi:set ts=4 sts=4 sw=4 binary noeol: */ 79 | 80 | ?> -------------------------------------------------------------------------------- /vendor-src/oauth-php/library/store/mysql/install.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /vendor-src/oauth-php/library/store/oracle/OracleDB/2_Sequences/SEQUENCES.sql: -------------------------------------------------------------------------------- 1 | CREATE SEQUENCE SEQ_OCT_ID NOCACHE; 2 | 3 | CREATE SEQUENCE SEQ_OCR_ID NOCACHE; 4 | 5 | CREATE SEQUENCE SEQ_OSR_ID NOCACHE; 6 | 7 | CREATE SEQUENCE SEQ_OSN_ID NOCACHE; 8 | 9 | CREATE SEQUENCE SEQ_OLG_ID NOCACHE; 10 | -------------------------------------------------------------------------------- /vendor-src/oauth-php/library/store/oracle/OracleDB/3_Procedures/SP_ADD_CONSUMER_REQUEST_TOKEN.prc: -------------------------------------------------------------------------------- 1 | CREATE OR REPLACE PROCEDURE SP_ADD_CONSUMER_REQUEST_TOKEN 2 | ( 3 | P_TOKEN_TTL IN NUMBER, -- IN SECOND 4 | P_CONSUMER_KEY IN VARCHAR2, 5 | P_TOKEN IN VARCHAR2, 6 | P_TOKEN_SECRET IN VARCHAR2, 7 | P_CALLBACK_URL IN VARCHAR2, 8 | P_RESULT OUT NUMBER 9 | ) 10 | AS 11 | 12 | -- PROCEDURE TO Add an unautorized request token to our server. 13 | 14 | V_OSR_ID NUMBER; 15 | V_OSR_ID_REF NUMBER; 16 | 17 | V_EXC_NO_SERVER_EXIST EXCEPTION; 18 | BEGIN 19 | 20 | P_RESULT := 0; 21 | 22 | BEGIN 23 | SELECT OSR_ID INTO V_OSR_ID 24 | FROM OAUTH_SERVER_REGISTRY 25 | WHERE OSR_CONSUMER_KEY = P_CONSUMER_KEY 26 | AND OSR_ENABLED = 1; 27 | EXCEPTION 28 | WHEN NO_DATA_FOUND THEN 29 | RAISE V_EXC_NO_SERVER_EXIST; 30 | END; 31 | 32 | 33 | BEGIN 34 | SELECT OST_OSR_ID_REF INTO V_OSR_ID_REF 35 | FROM OAUTH_SERVER_TOKEN 36 | WHERE OST_OSR_ID_REF = V_OSR_ID; 37 | 38 | UPDATE OAUTH_SERVER_TOKEN 39 | SET OST_OSR_ID_REF = V_OSR_ID, 40 | OST_USA_ID_REF = 1, 41 | OST_TOKEN = P_TOKEN, 42 | OST_TOKEN_SECRET = P_TOKEN_SECRET, 43 | OST_TOKEN_TYPE = 'REQUEST', 44 | OST_TOKEN_TTL = SYSDATE + (P_TOKEN_TTL/(24*60*60)), 45 | OST_CALLBACK_URL = P_CALLBACK_URL, 46 | OST_TIMESTAMP = SYSDATE 47 | WHERE OST_OSR_ID_REF = V_OSR_ID_REF; 48 | 49 | 50 | EXCEPTION 51 | WHEN NO_DATA_FOUND THEN 52 | 53 | INSERT INTO OAUTH_SERVER_TOKEN 54 | (OST_ID, OST_OSR_ID_REF, OST_USA_ID_REF, OST_TOKEN, OST_TOKEN_SECRET, OST_TOKEN_TYPE, 55 | OST_TOKEN_TTL, OST_CALLBACK_URL) 56 | VALUES 57 | (SEQ_OCT_ID.NEXTVAL, V_OSR_ID, 1, P_TOKEN, P_TOKEN_SECRET, 'REQUEST', SYSDATE + (P_TOKEN_TTL/(24*60*60)), 58 | P_CALLBACK_URL); 59 | 60 | END; 61 | 62 | 63 | EXCEPTION 64 | WHEN V_EXC_NO_SERVER_EXIST THEN 65 | P_RESULT := 2; -- NO_SERVER_EXIST 66 | WHEN OTHERS THEN 67 | -- CALL THE FUNCTION TO LOG ERRORS 68 | ROLLBACK; 69 | P_RESULT := 1; -- ERROR 70 | END; 71 | / 72 | -------------------------------------------------------------------------------- /vendor-src/oauth-php/library/store/oracle/OracleDB/3_Procedures/SP_ADD_LOG.prc: -------------------------------------------------------------------------------- 1 | CREATE OR REPLACE PROCEDURE SP_ADD_LOG 2 | ( 3 | P_RECEIVED IN VARCHAR2, 4 | P_SENT IN VARCHAR2, 5 | P_BASE_STRING IN VARCHAR2, 6 | P_NOTES IN VARCHAR2, 7 | P_USA_ID_REF IN NUMBER, 8 | P_REMOTE_IP IN VARCHAR2, 9 | P_RESULT OUT NUMBER 10 | ) 11 | AS 12 | 13 | -- PROCEDURE TO Add an entry to the log table 14 | 15 | BEGIN 16 | 17 | P_RESULT := 0; 18 | 19 | INSERT INTO oauth_log 20 | (OLG_ID, olg_received, olg_sent, olg_base_string, olg_notes, olg_usa_id_ref, olg_remote_ip) 21 | VALUES 22 | (SEQ_OLG_ID.NEXTVAL, P_RECEIVED, P_SENT, P_BASE_STRING, P_NOTES, NVL(P_USA_ID_REF, 0), P_REMOTE_IP); 23 | 24 | 25 | EXCEPTION 26 | WHEN OTHERS THEN 27 | -- CALL THE FUNCTION TO LOG ERRORS 28 | ROLLBACK; 29 | P_RESULT := 1; -- ERROR 30 | END; 31 | / 32 | -------------------------------------------------------------------------------- /vendor-src/oauth-php/library/store/oracle/OracleDB/3_Procedures/SP_ADD_SERVER_TOKEN.prc: -------------------------------------------------------------------------------- 1 | CREATE OR REPLACE PROCEDURE SP_ADD_SERVER_TOKEN 2 | ( 3 | P_CONSUMER_KEY IN VARCHAR2, 4 | P_USER_ID IN NUMBER, 5 | P_NAME IN VARCHAR2, 6 | P_TOKEN_TYPE IN VARCHAR2, 7 | P_TOKEN IN VARCHAR2, 8 | P_TOKEN_SECRET IN VARCHAR2, 9 | P_TOKEN_INTERVAL_IN_SEC IN NUMBER, 10 | P_RESULT OUT NUMBER 11 | ) 12 | AS 13 | 14 | -- Add a request token we obtained from a server. 15 | V_OCR_ID NUMBER; 16 | V_TOKEN_TTL DATE; 17 | 18 | V_EXC_INVALID_CONSUMER_KEY EXCEPTION; 19 | BEGIN 20 | P_RESULT := 0; 21 | 22 | BEGIN 23 | SELECT OCR_ID INTO V_OCR_ID FROM OAUTH_CONSUMER_REGISTRY 24 | WHERE OCR_CONSUMER_KEY = P_CONSUMER_KEY AND OCR_USA_ID_REF = P_USER_ID; 25 | EXCEPTION 26 | WHEN NO_DATA_FOUND THEN 27 | RAISE V_EXC_INVALID_CONSUMER_KEY; 28 | END; 29 | 30 | DELETE FROM OAUTH_CONSUMER_TOKEN 31 | WHERE OCT_OCR_ID_REF = V_OCR_ID 32 | AND OCT_USA_ID_REF = P_USER_ID 33 | AND UPPER(OCT_TOKEN_TYPE) = UPPER(P_TOKEN_TYPE) 34 | AND OCT_NAME = P_NAME; 35 | 36 | IF P_TOKEN_INTERVAL_IN_SEC IS NOT NULL THEN 37 | V_TOKEN_TTL := SYSDATE + (P_TOKEN_INTERVAL_IN_SEC/(24*60*60)); 38 | ELSE 39 | V_TOKEN_TTL := TO_DATE('9999.12.31', 'yyyy.mm.dd'); 40 | END IF; 41 | 42 | INSERT INTO OAUTH_CONSUMER_TOKEN 43 | (OCT_ID, OCT_OCR_ID_REF,OCT_USA_ID_REF, OCT_NAME, OCT_TOKEN, OCT_TOKEN_SECRET, OCT_TOKEN_TYPE, OCT_TIMESTAMP, OCT_TOKEN_TTL) 44 | VALUES 45 | (SEQ_OCT_ID.NEXTVAL, V_OCR_ID, P_USER_ID, P_NAME, P_TOKEN, P_TOKEN_SECRET, UPPER(P_TOKEN_TYPE), SYSDATE, V_TOKEN_TTL); 46 | 47 | EXCEPTION 48 | WHEN V_EXC_INVALID_CONSUMER_KEY THEN 49 | P_RESULT := 2; -- INVALID_CONSUMER_KEY 50 | WHEN OTHERS THEN 51 | -- CALL THE FUNCTION TO LOG ERRORS 52 | ROLLBACK; 53 | P_RESULT := 1; -- ERROR 54 | END; 55 | / 56 | -------------------------------------------------------------------------------- /vendor-src/oauth-php/library/store/oracle/OracleDB/3_Procedures/SP_AUTH_CONSUMER_REQ_TOKEN.prc: -------------------------------------------------------------------------------- 1 | CREATE OR REPLACE PROCEDURE SP_AUTH_CONSUMER_REQ_TOKEN 2 | ( 3 | P_USER_ID IN NUMBER, 4 | P_REFERRER_HOST IN VARCHAR2, 5 | P_VERIFIER IN VARCHAR2, 6 | P_TOKEN IN VARCHAR2, 7 | P_RESULT OUT NUMBER 8 | ) 9 | AS 10 | 11 | -- PROCEDURE TO Fetch the consumer request token, by request token. 12 | BEGIN 13 | P_RESULT := 0; 14 | 15 | 16 | UPDATE OAUTH_SERVER_TOKEN 17 | SET OST_AUTHORIZED = 1, 18 | OST_USA_ID_REF = P_USER_ID, 19 | OST_TIMESTAMP = SYSDATE, 20 | OST_REFERRER_HOST = P_REFERRER_HOST, 21 | OST_VERIFIER = P_VERIFIER 22 | WHERE OST_TOKEN = P_TOKEN 23 | AND OST_TOKEN_TYPE = 'REQUEST'; 24 | 25 | 26 | EXCEPTION 27 | WHEN OTHERS THEN 28 | -- CALL THE FUNCTION TO LOG ERRORS 29 | ROLLBACK; 30 | P_RESULT := 1; -- ERROR 31 | END; 32 | / 33 | -------------------------------------------------------------------------------- /vendor-src/oauth-php/library/store/oracle/OracleDB/3_Procedures/SP_CHECK_SERVER_NONCE.prc: -------------------------------------------------------------------------------- 1 | CREATE OR REPLACE PROCEDURE SP_CHECK_SERVER_NONCE 2 | ( 3 | P_CONSUMER_KEY IN VARCHAR2, 4 | P_TOKEN IN VARCHAR2, 5 | P_TIMESTAMP IN NUMBER, 6 | P_MAX_TIMESTAMP_SKEW IN NUMBER, 7 | P_NONCE IN VARCHAR2, 8 | P_RESULT OUT NUMBER 9 | ) 10 | AS 11 | 12 | -- PROCEDURE TO Check an nonce/timestamp combination. Clears any nonce combinations 13 | -- that are older than the one received. 14 | V_IS_MAX NUMBER; 15 | V_MAX_TIMESTAMP NUMBER; 16 | V_IS_DUPLICATE_TIMESTAMP NUMBER; 17 | 18 | V_EXC_INVALID_TIMESTAMP EXCEPTION; 19 | V_EXC_DUPLICATE_TIMESTAMP EXCEPTION; 20 | BEGIN 21 | 22 | P_RESULT := 0; 23 | 24 | BEGIN 25 | SELECT MAX(OSN_TIMESTAMP), 26 | CASE 27 | WHEN MAX(OSN_TIMESTAMP) > (P_TIMESTAMP + P_MAX_TIMESTAMP_SKEW) THEN 1 ELSE 0 28 | END "IS_MAX" INTO V_MAX_TIMESTAMP, V_IS_MAX 29 | FROM OAUTH_SERVER_NONCE 30 | WHERE OSN_CONSUMER_KEY = P_CONSUMER_KEY 31 | AND OSN_TOKEN = P_TOKEN; 32 | 33 | IF V_IS_MAX = 1 THEN 34 | RAISE V_EXC_INVALID_TIMESTAMP; 35 | END IF; 36 | 37 | EXCEPTION 38 | WHEN NO_DATA_FOUND THEN 39 | NULL; 40 | END; 41 | 42 | BEGIN 43 | SELECT 1 INTO V_IS_DUPLICATE_TIMESTAMP FROM DUAL WHERE EXISTS 44 | (SELECT OSN_ID FROM OAUTH_SERVER_NONCE 45 | WHERE OSN_CONSUMER_KEY = P_CONSUMER_KEY 46 | AND OSN_TOKEN = P_TOKEN 47 | AND OSN_TIMESTAMP = P_TIMESTAMP 48 | AND OSN_NONCE = P_NONCE); 49 | 50 | IF V_IS_DUPLICATE_TIMESTAMP = 1 THEN 51 | RAISE V_EXC_DUPLICATE_TIMESTAMP; 52 | END IF; 53 | EXCEPTION 54 | WHEN NO_DATA_FOUND THEN 55 | NULL; 56 | END; 57 | 58 | -- Insert the new combination 59 | INSERT INTO OAUTH_SERVER_NONCE 60 | (OSN_ID, OSN_CONSUMER_KEY, OSN_TOKEN, OSN_TIMESTAMP, OSN_NONCE) 61 | VALUES 62 | (SEQ_OSN_ID.NEXTVAL, P_CONSUMER_KEY, P_TOKEN, P_TIMESTAMP, P_NONCE); 63 | 64 | -- Clean up all timestamps older than the one we just received 65 | DELETE FROM OAUTH_SERVER_NONCE 66 | WHERE OSN_CONSUMER_KEY = P_CONSUMER_KEY 67 | AND OSN_TOKEN = P_TOKEN 68 | AND OSN_TIMESTAMP < (P_TIMESTAMP - P_MAX_TIMESTAMP_SKEW); 69 | 70 | 71 | EXCEPTION 72 | WHEN V_EXC_INVALID_TIMESTAMP THEN 73 | P_RESULT := 2; -- INVALID_TIMESTAMP 74 | WHEN V_EXC_DUPLICATE_TIMESTAMP THEN 75 | P_RESULT := 3; -- DUPLICATE_TIMESTAMP 76 | WHEN OTHERS THEN 77 | -- CALL THE FUNCTION TO LOG ERRORS 78 | ROLLBACK; 79 | P_RESULT := 1; -- ERROR 80 | END; 81 | / 82 | -------------------------------------------------------------------------------- /vendor-src/oauth-php/library/store/oracle/OracleDB/3_Procedures/SP_CONSUMER_STATIC_SAVE.prc: -------------------------------------------------------------------------------- 1 | CREATE OR REPLACE PROCEDURE SP_CONSUMER_STATIC_SAVE 2 | ( 3 | P_OSR_CONSUMER_KEY IN VARCHAR2, 4 | P_RESULT OUT NUMBER 5 | ) 6 | AS 7 | 8 | -- PROCEDURE TO Fetch the static consumer key for this provider. 9 | BEGIN 10 | P_RESULT := 0; 11 | 12 | 13 | INSERT INTO OAUTH_SERVER_REGISTRY 14 | (OSR_ID, OSR_ENABLED, OSR_STATUS, OSR_USA_ID_REF, OSR_CONSUMER_KEY, OSR_CONSUMER_SECRET, OSR_REQUESTER_NAME, OSR_REQUESTER_EMAIL, OSR_CALLBACK_URI, 15 | OSR_APPLICATION_URI, OSR_APPLICATION_TITLE, OSR_APPLICATION_DESCR, OSR_APPLICATION_NOTES, 16 | OSR_APPLICATION_TYPE, OSR_APPLICATION_COMMERCIAL, OSR_TIMESTAMP,OSR_ISSUE_DATE) 17 | VALUES 18 | (SEQ_OSR_ID.NEXTVAL, 1, 'ACTIVE', NULL, P_OSR_CONSUMER_KEY, '\', '\', '\', '\', '\', 19 | 'STATIC SHARED CONSUMER KEY', '\', 'STATIC SHARED CONSUMER KEY', '\', 0, SYSDATE, SYSDATE); 20 | 21 | 22 | EXCEPTION 23 | WHEN OTHERS THEN 24 | -- CALL THE FUNCTION TO LOG ERRORS 25 | ROLLBACK; 26 | P_RESULT := 1; -- ERROR 27 | END; 28 | / 29 | -------------------------------------------------------------------------------- /vendor-src/oauth-php/library/store/oracle/OracleDB/3_Procedures/SP_COUNT_CONSUMER_ACCESS_TOKEN.prc: -------------------------------------------------------------------------------- 1 | CREATE OR REPLACE PROCEDURE SP_COUNT_CONSUMER_ACCESS_TOKEN 2 | ( 3 | P_CONSUMER_KEY IN VARCHAR2, 4 | P_COUNT OUT NUMBER, 5 | P_RESULT OUT NUMBER 6 | ) 7 | AS 8 | -- PROCEDURE TO Count the consumer access tokens for the given consumer. 9 | BEGIN 10 | P_RESULT := 0; 11 | 12 | SELECT COUNT(OST_ID) INTO P_COUNT 13 | FROM OAUTH_SERVER_TOKEN 14 | JOIN OAUTH_SERVER_REGISTRY 15 | ON OST_OSR_ID_REF = OSR_ID 16 | WHERE OST_TOKEN_TYPE = 'ACCESS' 17 | AND OSR_CONSUMER_KEY = P_CONSUMER_KEY 18 | AND OST_TOKEN_TTL >= SYSDATE; 19 | 20 | 21 | EXCEPTION 22 | WHEN OTHERS THEN 23 | -- CALL THE FUNCTION TO LOG ERRORS 24 | ROLLBACK; 25 | P_RESULT := 1; -- ERROR 26 | END; 27 | / 28 | -------------------------------------------------------------------------------- /vendor-src/oauth-php/library/store/oracle/OracleDB/3_Procedures/SP_COUNT_SERVICE_TOKENS.prc: -------------------------------------------------------------------------------- 1 | CREATE OR REPLACE PROCEDURE SP_COUNT_SERVICE_TOKENS 2 | ( 3 | P_CONSUMER_KEY IN VARCHAR2, 4 | P_COUNT OUT NUMBER, 5 | P_RESULT OUT NUMBER 6 | ) 7 | AS 8 | 9 | -- PROCEDURE TO Count how many tokens we have for the given server 10 | BEGIN 11 | P_RESULT := 0; 12 | 13 | SELECT COUNT(OCT_ID) INTO P_COUNT 14 | FROM OAUTH_CONSUMER_TOKEN 15 | JOIN OAUTH_CONSUMER_REGISTRY 16 | ON OCT_OCR_ID_REF = OCR_ID 17 | WHERE OCT_TOKEN_TYPE = 'ACCESS' 18 | AND OCR_CONSUMER_KEY = P_CONSUMER_KEY 19 | AND OCT_TOKEN_TTL >= SYSDATE; 20 | 21 | 22 | EXCEPTION 23 | WHEN OTHERS THEN 24 | -- CALL THE FUNCTION TO LOG ERRORS 25 | ROLLBACK; 26 | P_RESULT := 1; -- ERROR 27 | END; 28 | / 29 | -------------------------------------------------------------------------------- /vendor-src/oauth-php/library/store/oracle/OracleDB/3_Procedures/SP_DELETE_CONSUMER.prc: -------------------------------------------------------------------------------- 1 | CREATE OR REPLACE PROCEDURE SP_DELETE_CONSUMER 2 | ( 3 | P_CONSUMER_KEY IN VARCHAR2, 4 | P_USER_ID IN NUMBER, 5 | P_USER_IS_ADMIN IN NUMBER, --0:NO; 1:YES 6 | P_RESULT OUT NUMBER 7 | ) 8 | AS 9 | 10 | -- Delete a consumer key. This removes access to our site for all applications using this key. 11 | 12 | BEGIN 13 | P_RESULT := 0; 14 | 15 | IF P_USER_IS_ADMIN = 1 THEN 16 | 17 | DELETE FROM OAUTH_SERVER_REGISTRY 18 | WHERE OSR_CONSUMER_KEY = P_CONSUMER_KEY 19 | AND (OSR_USA_ID_REF = P_USER_ID OR OSR_USA_ID_REF IS NULL); 20 | 21 | ELSIF P_USER_IS_ADMIN = 0 THEN 22 | 23 | DELETE FROM OAUTH_SERVER_REGISTRY 24 | WHERE OSR_CONSUMER_KEY = P_CONSUMER_KEY 25 | AND OSR_USA_ID_REF = P_USER_ID; 26 | 27 | END IF; 28 | 29 | EXCEPTION 30 | WHEN OTHERS THEN 31 | -- CALL THE FUNCTION TO LOG ERRORS 32 | ROLLBACK; 33 | P_RESULT := 1; -- ERROR 34 | END; 35 | / 36 | -------------------------------------------------------------------------------- /vendor-src/oauth-php/library/store/oracle/OracleDB/3_Procedures/SP_DELETE_SERVER.prc: -------------------------------------------------------------------------------- 1 | CREATE OR REPLACE PROCEDURE SP_DELETE_SERVER 2 | ( 3 | P_CONSUMER_KEY IN VARCHAR2, 4 | P_USER_ID IN NUMBER, 5 | P_USER_IS_ADMIN IN NUMBER, --0:NO; 1:YES 6 | P_RESULT OUT NUMBER 7 | ) 8 | AS 9 | 10 | -- Delete a server key. This removes access to that site. 11 | 12 | BEGIN 13 | P_RESULT := 0; 14 | 15 | IF P_USER_IS_ADMIN = 1 THEN 16 | 17 | DELETE FROM OAUTH_CONSUMER_REGISTRY 18 | WHERE OCR_CONSUMER_KEY = P_CONSUMER_KEY 19 | AND (OCR_USA_ID_REF = P_USER_ID OR OCR_USA_ID_REF IS NULL); 20 | 21 | ELSIF P_USER_IS_ADMIN = 0 THEN 22 | 23 | DELETE FROM OAUTH_CONSUMER_REGISTRY 24 | WHERE OCR_CONSUMER_KEY = P_CONSUMER_KEY 25 | AND OCR_USA_ID_REF = P_USER_ID; 26 | 27 | END IF; 28 | 29 | EXCEPTION 30 | WHEN OTHERS THEN 31 | -- CALL THE FUNCTION TO LOG ERRORS 32 | ROLLBACK; 33 | P_RESULT := 1; -- ERROR 34 | END; 35 | / 36 | -------------------------------------------------------------------------------- /vendor-src/oauth-php/library/store/oracle/OracleDB/3_Procedures/SP_DELETE_SERVER_TOKEN.prc: -------------------------------------------------------------------------------- 1 | CREATE OR REPLACE PROCEDURE SP_DELETE_SERVER_TOKEN 2 | ( 3 | P_CONSUMER_KEY IN VARCHAR2, 4 | P_USER_ID IN NUMBER, 5 | P_TOKEN IN VARCHAR2, 6 | P_USER_IS_ADMIN IN NUMBER, --0:NO; 1:YES 7 | P_RESULT OUT NUMBER 8 | ) 9 | AS 10 | 11 | -- Delete a token we obtained from a server. 12 | 13 | BEGIN 14 | P_RESULT := 0; 15 | 16 | IF P_USER_IS_ADMIN = 1 THEN 17 | 18 | DELETE FROM OAUTH_CONSUMER_TOKEN 19 | WHERE OCT_TOKEN = P_TOKEN 20 | AND OCT_OCR_ID_REF IN (SELECT OCR_ID FROM OAUTH_CONSUMER_REGISTRY WHERE OCR_CONSUMER_KEY = P_CONSUMER_KEY); 21 | 22 | ELSIF P_USER_IS_ADMIN = 0 THEN 23 | 24 | DELETE FROM OAUTH_CONSUMER_TOKEN 25 | WHERE OCT_TOKEN = P_TOKEN 26 | AND OCT_USA_ID_REF = P_USER_ID 27 | AND OCT_OCR_ID_REF IN (SELECT OCR_ID FROM OAUTH_CONSUMER_REGISTRY WHERE OCR_CONSUMER_KEY = P_CONSUMER_KEY); 28 | 29 | END IF; 30 | 31 | EXCEPTION 32 | WHEN OTHERS THEN 33 | -- CALL THE FUNCTION TO LOG ERRORS 34 | ROLLBACK; 35 | P_RESULT := 1; -- ERROR 36 | END; 37 | / 38 | -------------------------------------------------------------------------------- /vendor-src/oauth-php/library/store/oracle/OracleDB/3_Procedures/SP_DEL_CONSUMER_ACCESS_TOKEN.prc: -------------------------------------------------------------------------------- 1 | CREATE OR REPLACE PROCEDURE SP_DEL_CONSUMER_ACCESS_TOKEN 2 | ( 3 | P_USER_ID IN NUMBER, 4 | P_TOKEN IN VARCHAR2, 5 | P_USER_IS_ADMIN IN NUMBER, -- 1:YES; 0:NO 6 | P_RESULT OUT NUMBER 7 | ) 8 | AS 9 | 10 | -- PROCEDURE TO Delete a consumer access token. 11 | 12 | BEGIN 13 | 14 | P_RESULT := 0; 15 | 16 | IF P_USER_IS_ADMIN = 1 THEN 17 | DELETE FROM OAUTH_SERVER_TOKEN 18 | WHERE OST_TOKEN = P_TOKEN 19 | AND OST_TOKEN_TYPE = 'ACCESS'; 20 | ELSE 21 | DELETE FROM OAUTH_SERVER_TOKEN 22 | WHERE OST_TOKEN = P_TOKEN 23 | AND OST_TOKEN_TYPE = 'ACCESS' 24 | AND OST_USA_ID_REF = P_USER_ID; 25 | END IF; 26 | 27 | EXCEPTION 28 | WHEN OTHERS THEN 29 | -- CALL THE FUNCTION TO LOG ERRORS 30 | ROLLBACK; 31 | P_RESULT := 1; -- ERROR 32 | END; 33 | / 34 | -------------------------------------------------------------------------------- /vendor-src/oauth-php/library/store/oracle/OracleDB/3_Procedures/SP_DEL_CONSUMER_REQUEST_TOKEN.prc: -------------------------------------------------------------------------------- 1 | CREATE OR REPLACE PROCEDURE SP_DEL_CONSUMER_REQUEST_TOKEN 2 | ( 3 | P_TOKEN IN VARCHAR2, 4 | P_RESULT OUT NUMBER 5 | ) 6 | AS 7 | 8 | -- PROCEDURE TO Delete a consumer token. The token must be a request or authorized token. 9 | 10 | BEGIN 11 | 12 | P_RESULT := 0; 13 | 14 | DELETE FROM OAUTH_SERVER_TOKEN 15 | WHERE OST_TOKEN = P_TOKEN 16 | AND OST_TOKEN_TYPE = 'REQUEST'; 17 | 18 | 19 | EXCEPTION 20 | WHEN OTHERS THEN 21 | -- CALL THE FUNCTION TO LOG ERRORS 22 | ROLLBACK; 23 | P_RESULT := 1; -- ERROR 24 | END; 25 | / 26 | -------------------------------------------------------------------------------- /vendor-src/oauth-php/library/store/oracle/OracleDB/3_Procedures/SP_GET_CONSUMER.prc: -------------------------------------------------------------------------------- 1 | CREATE OR REPLACE PROCEDURE SP_GET_CONSUMER 2 | ( 3 | P_CONSUMER_KEY IN STRING, 4 | P_ROWS OUT TYPES.REF_CURSOR, 5 | P_RESULT OUT NUMBER 6 | ) 7 | AS 8 | 9 | -- PROCEDURE TO Fetch a consumer of this server, by consumer_key. 10 | BEGIN 11 | P_RESULT := 0; 12 | 13 | OPEN P_ROWS FOR 14 | SELECT OSR_ID "osr_id", 15 | OSR_USA_ID_REF "osr_usa_id_ref", 16 | OSR_CONSUMER_KEY "osr_consumer_key", 17 | OSR_CONSUMER_SECRET "osr_consumer_secret", 18 | OSR_ENABLED "osr_enabled", 19 | OSR_STATUS "osr_status", 20 | OSR_REQUESTER_NAME "osr_requester_name", 21 | OSR_REQUESTER_EMAIL "osr_requester_email", 22 | OSR_CALLBACK_URI "osr_callback_uri", 23 | OSR_APPLICATION_URI "osr_application_uri", 24 | OSR_APPLICATION_TITLE "osr_application_title", 25 | OSR_APPLICATION_DESCR "osr_application_descr", 26 | OSR_APPLICATION_NOTES "osr_application_notes", 27 | OSR_APPLICATION_TYPE "osr_application_type", 28 | OSR_APPLICATION_COMMERCIAL "osr_application_commercial", 29 | OSR_ISSUE_DATE "osr_issue_date", 30 | OSR_TIMESTAMP "osr_timestamp" 31 | FROM OAUTH_SERVER_REGISTRY 32 | WHERE OSR_CONSUMER_KEY = P_CONSUMER_KEY; 33 | 34 | 35 | EXCEPTION 36 | WHEN OTHERS THEN 37 | -- CALL THE FUNCTION TO LOG ERRORS 38 | ROLLBACK; 39 | P_RESULT := 1; -- ERROR 40 | END; 41 | / 42 | -------------------------------------------------------------------------------- /vendor-src/oauth-php/library/store/oracle/OracleDB/3_Procedures/SP_GET_CONSUMER_ACCESS_TOKEN.prc: -------------------------------------------------------------------------------- 1 | CREATE OR REPLACE PROCEDURE SP_GET_CONSUMER_ACCESS_TOKEN 2 | ( 3 | P_USER_ID IN NUMBER, 4 | P_TOKEN IN VARCHAR2, 5 | P_ROWS OUT TYPES.REF_CURSOR, 6 | P_RESULT OUT NUMBER 7 | ) 8 | AS 9 | 10 | -- PROCEDURE TO Fetch the consumer access token, by access token. 11 | 12 | BEGIN 13 | 14 | P_RESULT := 0; 15 | 16 | 17 | OPEN P_ROWS FOR 18 | SELECT OST_TOKEN "token", 19 | OST_TOKEN_SECRET "token_secret", 20 | OST_REFERRER_HOST "token_referrer_host", 21 | OSR_CONSUMER_KEY "consumer_key", 22 | OSR_CONSUMER_SECRET "consumer_secret", 23 | OSR_APPLICATION_URI "application_uri", 24 | OSR_APPLICATION_TITLE "application_title", 25 | OSR_APPLICATION_DESCR "application_descr", 26 | OSR_CALLBACK_URI "callback_uri" 27 | FROM OAUTH_SERVER_TOKEN 28 | JOIN OAUTH_SERVER_REGISTRY 29 | ON OST_OSR_ID_REF = OSR_ID 30 | WHERE OST_TOKEN_TYPE = 'ACCESS' 31 | AND OST_TOKEN = P_TOKEN 32 | AND OST_USA_ID_REF = P_USER_ID 33 | AND OST_TOKEN_TTL >= SYSDATE; 34 | 35 | 36 | 37 | EXCEPTION 38 | WHEN OTHERS THEN 39 | -- CALL THE FUNCTION TO LOG ERRORS 40 | ROLLBACK; 41 | P_RESULT := 1; -- ERROR 42 | END; 43 | / 44 | -------------------------------------------------------------------------------- /vendor-src/oauth-php/library/store/oracle/OracleDB/3_Procedures/SP_GET_CONSUMER_REQUEST_TOKEN.prc: -------------------------------------------------------------------------------- 1 | CREATE OR REPLACE PROCEDURE SP_GET_CONSUMER_REQUEST_TOKEN 2 | ( 3 | P_TOKEN IN VARCHAR2, 4 | P_ROWS OUT TYPES.REF_CURSOR, 5 | P_RESULT OUT NUMBER 6 | ) 7 | AS 8 | 9 | -- PROCEDURE TO Fetch the consumer request token, by request token. 10 | BEGIN 11 | P_RESULT := 0; 12 | 13 | OPEN P_ROWS FOR 14 | 15 | SELECT OST_TOKEN "token", 16 | OST_TOKEN_SECRET "token_secret", 17 | OSR_CONSUMER_KEY "consumer_key", 18 | OSR_CONSUMER_SECRET "consumer_secret", 19 | OST_TOKEN_TYPE "token_type", 20 | OST_CALLBACK_URL "callback_url", 21 | OSR_APPLICATION_TITLE "application_title", 22 | OSR_APPLICATION_DESCR "application_descr", 23 | OSR_APPLICATION_URI "application_uri" 24 | FROM OAUTH_SERVER_TOKEN 25 | JOIN OAUTH_SERVER_REGISTRY 26 | ON OST_OSR_ID_REF = OSR_ID 27 | WHERE OST_TOKEN_TYPE = 'REQUEST' 28 | AND OST_TOKEN = P_TOKEN 29 | AND OST_TOKEN_TTL >= SYSDATE; 30 | 31 | 32 | 33 | 34 | 35 | EXCEPTION 36 | WHEN OTHERS THEN 37 | -- CALL THE FUNCTION TO LOG ERRORS 38 | ROLLBACK; 39 | P_RESULT := 1; -- ERROR 40 | END; 41 | / 42 | -------------------------------------------------------------------------------- /vendor-src/oauth-php/library/store/oracle/OracleDB/3_Procedures/SP_GET_CONSUMER_STATIC_SELECT.prc: -------------------------------------------------------------------------------- 1 | CREATE OR REPLACE PROCEDURE SP_GET_CONSUMER_STATIC_SELECT 2 | ( 3 | P_OSR_CONSUMER_KEY OUT VARCHAR2, 4 | P_RESULT OUT NUMBER 5 | ) 6 | AS 7 | 8 | -- PROCEDURE TO Fetch the static consumer key for this provider. 9 | BEGIN 10 | P_RESULT := 0; 11 | 12 | 13 | SELECT OSR_CONSUMER_KEY INTO P_OSR_CONSUMER_KEY 14 | FROM OAUTH_SERVER_REGISTRY 15 | WHERE OSR_CONSUMER_KEY LIKE 'sc-%%' 16 | AND OSR_USA_ID_REF IS NULL; 17 | 18 | 19 | EXCEPTION 20 | WHEN OTHERS THEN 21 | -- CALL THE FUNCTION TO LOG ERRORS 22 | ROLLBACK; 23 | P_RESULT := 1; -- ERROR 24 | END; 25 | / 26 | -------------------------------------------------------------------------------- /vendor-src/oauth-php/library/store/oracle/OracleDB/3_Procedures/SP_GET_SECRETS_FOR_SIGNATURE.prc: -------------------------------------------------------------------------------- 1 | CREATE OR REPLACE PROCEDURE SP_GET_SECRETS_FOR_SIGNATURE 2 | ( 3 | P_HOST IN VARCHAR2, 4 | P_PATH IN VARCHAR2, 5 | P_USER_ID IN NUMBER, 6 | P_NAME IN VARCHAR2, 7 | P_ROWS OUT TYPES.REF_CURSOR, 8 | P_RESULT OUT NUMBER 9 | ) 10 | AS 11 | 12 | -- PROCEDURE TO Find the server details for signing a request, always looks for an access token. 13 | -- The returned credentials depend on which local user is making the request. 14 | BEGIN 15 | P_RESULT := 0; 16 | 17 | OPEN P_ROWS FOR 18 | SELECT * FROM ( 19 | SELECT OCR_CONSUMER_KEY "consumer_key", 20 | OCR_CONSUMER_SECRET "consumer_secret", 21 | OCT_TOKEN "token", 22 | OCT_TOKEN_SECRET "token_secret", 23 | OCR_SIGNATURE_METHODS "signature_methods" 24 | FROM OAUTH_CONSUMER_REGISTRY 25 | JOIN OAUTH_CONSUMER_TOKEN ON OCT_OCR_ID_REF = OCR_ID 26 | WHERE OCR_SERVER_URI_HOST = P_HOST 27 | AND OCR_SERVER_URI_PATH = SUBSTR(P_PATH, 1, LENGTH(OCR_SERVER_URI_PATH)) 28 | AND (OCR_USA_ID_REF = P_USER_ID OR OCR_USA_ID_REF IS NULL) 29 | AND OCT_USA_ID_REF = P_USER_ID 30 | AND OCT_TOKEN_TYPE = 'ACCESS' 31 | AND OCT_NAME = P_NAME 32 | AND OCT_TOKEN_TTL >= SYSDATE 33 | ORDER BY OCR_USA_ID_REF DESC, OCR_CONSUMER_SECRET DESC, LENGTH(OCR_SERVER_URI_PATH) DESC 34 | ) WHERE ROWNUM<=1; 35 | 36 | 37 | EXCEPTION 38 | WHEN OTHERS THEN 39 | -- CALL THE FUNCTION TO LOG ERRORS 40 | ROLLBACK; 41 | P_RESULT := 1; -- ERROR 42 | END; 43 | / 44 | -------------------------------------------------------------------------------- /vendor-src/oauth-php/library/store/oracle/OracleDB/3_Procedures/SP_GET_SECRETS_FOR_VERIFY.prc: -------------------------------------------------------------------------------- 1 | CREATE OR REPLACE PROCEDURE SP_GET_SECRETS_FOR_VERIFY 2 | ( 3 | P_CONSUMER_KEY IN VARCHAR2, 4 | P_TOKEN IN VARCHAR2, 5 | P_TOKEN_TYPE IN VARCHAR2, 6 | P_ROWS OUT TYPES.REF_CURSOR, 7 | P_RESULT OUT NUMBER 8 | ) 9 | AS 10 | 11 | -- PROCEDURE to Find stored credentials for the consumer key and token. Used by an OAuth server 12 | -- when verifying an OAuth request. 13 | 14 | BEGIN 15 | P_RESULT := 0; 16 | 17 | IF P_TOKEN_TYPE IS NULL THEN 18 | OPEN P_ROWS FOR 19 | SELECT OSR.OSR_ID "osr_id", 20 | OSR.OSR_CONSUMER_KEY "consumer_key", 21 | OSR.OSR_CONSUMER_SECRET "consumer_secret" 22 | FROM OAUTH_SERVER_REGISTRY OSR 23 | WHERE OSR.OSR_CONSUMER_KEY = P_CONSUMER_KEY 24 | AND OSR.OSR_ENABLED = 1; 25 | ELSE 26 | OPEN P_ROWS FOR 27 | SELECT OSR.OSR_ID "osr_id", 28 | OST.OST_ID "ost_id", 29 | OST.OST_USA_ID_REF "user_id", 30 | OSR.OSR_CONSUMER_KEY "consumer_key", 31 | OSR.OSR_CONSUMER_SECRET "consumer_secret", 32 | OST.OST_TOKEN "token", 33 | OST.OST_TOKEN_SECRET "token_secret" 34 | FROM OAUTH_SERVER_REGISTRY OSR, OAUTH_SERVER_TOKEN OST 35 | WHERE OST.OST_OSR_ID_REF = OSR.OSR_ID 36 | AND upper(OST.OST_TOKEN_TYPE) = upper(P_TOKEN_TYPE) 37 | AND OSR.OSR_CONSUMER_KEY = P_CONSUMER_KEY 38 | AND OST.OST_TOKEN = P_TOKEN 39 | AND OSR.OSR_ENABLED = 1 40 | AND OST.OST_TOKEN_TTL >= SYSDATE; 41 | 42 | END IF; 43 | 44 | 45 | 46 | EXCEPTION 47 | WHEN OTHERS THEN 48 | -- CALL THE FUNCTION TO LOG ERRORS 49 | ROLLBACK; 50 | P_RESULT := 1; -- ERROR 51 | END; 52 | / 53 | -------------------------------------------------------------------------------- /vendor-src/oauth-php/library/store/oracle/OracleDB/3_Procedures/SP_GET_SERVER.prc: -------------------------------------------------------------------------------- 1 | CREATE OR REPLACE PROCEDURE SP_GET_SERVER 2 | ( 3 | P_CONSUMER_KEY IN VARCHAR2, 4 | P_USER_ID IN NUMBER, 5 | P_ROWS OUT TYPES.REF_CURSOR, 6 | P_RESULT OUT NUMBER 7 | ) 8 | AS 9 | 10 | -- PROCEDURE TO Get a server from the consumer registry using the consumer key 11 | BEGIN 12 | P_RESULT := 0; 13 | 14 | OPEN P_ROWS FOR 15 | SELECT OCR_ID "id", 16 | OCR_USA_ID_REF "user_id", 17 | OCR_CONSUMER_KEY "consumer_key", 18 | OCR_CONSUMER_SECRET "consumer_secret", 19 | OCR_SIGNATURE_METHODS "signature_methods", 20 | OCR_SERVER_URI "server_uri", 21 | OCR_REQUEST_TOKEN_URI "request_token_uri", 22 | OCR_AUTHORIZE_URI "authorize_uri", 23 | OCR_ACCESS_TOKEN_URI "access_token_uri" 24 | FROM OAUTH_CONSUMER_REGISTRY 25 | WHERE OCR_CONSUMER_KEY = P_CONSUMER_KEY 26 | AND (OCR_USA_ID_REF = P_USER_ID OR OCR_USA_ID_REF IS NULL); 27 | 28 | 29 | EXCEPTION 30 | WHEN OTHERS THEN 31 | -- CALL THE FUNCTION TO LOG ERRORS 32 | ROLLBACK; 33 | P_RESULT := 1; -- ERROR 34 | END; 35 | / 36 | -------------------------------------------------------------------------------- /vendor-src/oauth-php/library/store/oracle/OracleDB/3_Procedures/SP_GET_SERVER_FOR_URI.prc: -------------------------------------------------------------------------------- 1 | CREATE OR REPLACE PROCEDURE SP_GET_SERVER_FOR_URI 2 | ( 3 | P_HOST IN VARCHAR2, 4 | P_PATH IN VARCHAR2, 5 | P_USER_ID IN NUMBER, 6 | P_ROWS OUT TYPES.REF_CURSOR, 7 | P_RESULT OUT NUMBER 8 | ) 9 | AS 10 | 11 | -- PROCEDURE TO Find the server details that might be used for a request 12 | BEGIN 13 | P_RESULT := 0; 14 | 15 | OPEN P_ROWS FOR 16 | SELECT * FROM ( 17 | SELECT OCR_ID "id", 18 | OCR_USA_ID_REF "user_id", 19 | OCR_CONSUMER_KEY "consumer_key", 20 | OCR_CONSUMER_SECRET "consumer_secret", 21 | OCR_SIGNATURE_METHODS "signature_methods", 22 | OCR_SERVER_URI "server_uri", 23 | OCR_REQUEST_TOKEN_URI "request_token_uri", 24 | OCR_AUTHORIZE_URI "authorize_uri", 25 | OCR_ACCESS_TOKEN_URI "access_token_uri" 26 | FROM OAUTH_CONSUMER_REGISTRY 27 | WHERE OCR_SERVER_URI_HOST = P_HOST 28 | AND OCR_SERVER_URI_PATH = SUBSTR(P_PATH, 1, LENGTH(OCR_SERVER_URI_PATH)) 29 | AND (OCR_USA_ID_REF = P_USER_ID OR OCR_USA_ID_REF IS NULL) 30 | ORDER BY ocr_usa_id_ref DESC, OCR_CONSUMER_KEY DESC, LENGTH(ocr_server_uri_path) DESC 31 | ) WHERE ROWNUM<=1; 32 | 33 | 34 | 35 | EXCEPTION 36 | WHEN OTHERS THEN 37 | -- CALL THE FUNCTION TO LOG ERRORS 38 | ROLLBACK; 39 | P_RESULT := 1; -- ERROR 40 | END; 41 | / 42 | -------------------------------------------------------------------------------- /vendor-src/oauth-php/library/store/oracle/OracleDB/3_Procedures/SP_GET_SERVER_TOKEN.prc: -------------------------------------------------------------------------------- 1 | CREATE OR REPLACE PROCEDURE SP_GET_SERVER_TOKEN 2 | ( 3 | P_CONSUMER_KEY IN VARCHAR2, 4 | P_USER_ID IN NUMBER, 5 | P_TOKEN IN VARCHAR2, 6 | P_ROWS OUT TYPES.REF_CURSOR, 7 | P_RESULT OUT NUMBER 8 | ) 9 | AS 10 | 11 | -- PROCEDURE TO Get a specific server token for the given user 12 | BEGIN 13 | P_RESULT := 0; 14 | 15 | OPEN P_ROWS FOR 16 | SELECT OCR_CONSUMER_KEY "consumer_key", 17 | OCR_CONSUMER_SECRET "consumer_secret", 18 | OCT_TOKEN "token", 19 | OCT_TOKEN_SECRET "token_secret", 20 | OCT_USA_ID_REF "usr_id", 21 | OCR_SIGNATURE_METHODS "signature_methods", 22 | OCR_SERVER_URI "server_uri", 23 | OCR_SERVER_URI_HOST "server_uri_host", 24 | OCR_SERVER_URI_PATH "server_uri_path", 25 | OCR_REQUEST_TOKEN_URI "request_token_uri", 26 | OCR_AUTHORIZE_URI "authorize_uri", 27 | OCR_ACCESS_TOKEN_URI "access_token_uri", 28 | OCT_TIMESTAMP "timestamp" 29 | FROM OAUTH_CONSUMER_REGISTRY 30 | JOIN OAUTH_CONSUMER_TOKEN 31 | ON OCT_OCR_ID_REF = OCR_ID 32 | WHERE OCR_CONSUMER_KEY = P_CONSUMER_KEY 33 | AND OCT_USA_ID_REF = P_USER_ID 34 | AND OCT_TOKEN_TYPE = 'ACCESS' 35 | AND OCT_TOKEN = P_TOKEN 36 | AND OCT_TOKEN_TTL >= SYSDATE; 37 | 38 | 39 | EXCEPTION 40 | WHEN OTHERS THEN 41 | -- CALL THE FUNCTION TO LOG ERRORS 42 | ROLLBACK; 43 | P_RESULT := 1; -- ERROR 44 | END; 45 | / 46 | -------------------------------------------------------------------------------- /vendor-src/oauth-php/library/store/oracle/OracleDB/3_Procedures/SP_GET_SERVER_TOKEN_SECRETS.prc: -------------------------------------------------------------------------------- 1 | CREATE OR REPLACE PROCEDURE SP_GET_SERVER_TOKEN_SECRETS 2 | ( 3 | P_CONSUMER_KEY IN VARCHAR2, 4 | P_TOKEN IN VARCHAR2, 5 | P_TOKEN_TYPE IN VARCHAR2, 6 | P_USER_ID IN NUMBER, 7 | P_ROWS OUT TYPES.REF_CURSOR, 8 | P_RESULT OUT NUMBER 9 | ) 10 | AS 11 | 12 | -- Get the token and token secret we obtained from a server. 13 | 14 | BEGIN 15 | P_RESULT := 0; 16 | 17 | 18 | OPEN P_ROWS FOR 19 | SELECT OCR.OCR_CONSUMER_KEY "consumer_key", 20 | OCR.OCR_CONSUMER_SECRET "consumer_secret", 21 | OCT.OCT_TOKEN "token", 22 | OCT.OCT_TOKEN_SECRET "token_secret", 23 | OCT.OCT_NAME "token_name", 24 | OCR.OCR_SIGNATURE_METHODS "signature_methods", 25 | OCR.OCR_SERVER_URI "server_uri", 26 | OCR.OCR_REQUEST_TOKEN_URI "request_token_uri", 27 | OCR.OCR_AUTHORIZE_URI "authorize_uri", 28 | OCR.OCR_ACCESS_TOKEN_URI "access_token_uri", 29 | CASE WHEN OCT.OCT_TOKEN_TTL >= TO_DATE('9999.12.31', 'yyyy.mm.dd') THEN NULL 30 | ELSE OCT.OCT_TOKEN_TTL - SYSDATE 31 | END "token_ttl" 32 | FROM OAUTH_CONSUMER_REGISTRY OCR, OAUTH_CONSUMER_TOKEN OCT 33 | WHERE OCT.OCT_OCR_ID_REF = OCR_ID 34 | AND OCR.OCR_CONSUMER_KEY = P_CONSUMER_KEY 35 | AND upper(OCT.OCT_TOKEN_TYPE) = upper(P_TOKEN_TYPE) 36 | AND OCT.OCT_TOKEN = P_TOKEN 37 | AND OCT.OCT_USA_ID_REF = P_USER_ID 38 | AND OCT.OCT_TOKEN_TTL >= SYSDATE; 39 | 40 | 41 | EXCEPTION 42 | WHEN OTHERS THEN 43 | -- CALL THE FUNCTION TO LOG ERRORS 44 | ROLLBACK; 45 | P_RESULT := 1; -- ERROR 46 | END; 47 | / 48 | -------------------------------------------------------------------------------- /vendor-src/oauth-php/library/store/oracle/OracleDB/3_Procedures/SP_LIST_CONSUMERS.prc: -------------------------------------------------------------------------------- 1 | CREATE OR REPLACE PROCEDURE SP_LIST_CONSUMERS 2 | ( 3 | P_USER_ID IN NUMBER, 4 | P_ROWS OUT TYPES.REF_CURSOR, 5 | P_RESULT OUT NUMBER 6 | ) 7 | AS 8 | 9 | -- PROCEDURE TO Fetch a list of all consumer keys, secrets etc. 10 | -- Returns the public (user_id is null) and the keys owned by the user 11 | 12 | BEGIN 13 | 14 | P_RESULT := 0; 15 | 16 | OPEN P_ROWS FOR 17 | SELECT OSR_ID "id", 18 | OSR_USA_ID_REF "user_id", 19 | OSR_CONSUMER_KEY "consumer_key", 20 | OSR_CONSUMER_SECRET "consumer_secret", 21 | OSR_ENABLED "enabled", 22 | OSR_STATUS "status", 23 | OSR_ISSUE_DATE "issue_date", 24 | OSR_APPLICATION_URI "application_uri", 25 | OSR_APPLICATION_TITLE "application_title", 26 | OSR_APPLICATION_DESCR "application_descr", 27 | OSR_REQUESTER_NAME "requester_name", 28 | OSR_REQUESTER_EMAIL "requester_email", 29 | OSR_CALLBACK_URI "callback_uri" 30 | FROM OAUTH_SERVER_REGISTRY 31 | WHERE (OSR_USA_ID_REF = P_USER_ID OR OSR_USA_ID_REF IS NULL) 32 | ORDER BY OSR_APPLICATION_TITLE; 33 | 34 | 35 | EXCEPTION 36 | WHEN OTHERS THEN 37 | -- CALL THE FUNCTION TO LOG ERRORS 38 | ROLLBACK; 39 | P_RESULT := 1; -- ERROR 40 | END; 41 | / 42 | -------------------------------------------------------------------------------- /vendor-src/oauth-php/library/store/oracle/OracleDB/3_Procedures/SP_LIST_CONSUMER_TOKENS.prc: -------------------------------------------------------------------------------- 1 | CREATE OR REPLACE PROCEDURE SP_LIST_CONSUMER_TOKENS 2 | ( 3 | P_USER_ID IN NUMBER, 4 | P_ROWS OUT TYPES.REF_CURSOR, 5 | P_RESULT OUT NUMBER 6 | ) 7 | AS 8 | 9 | -- PROCEDURE TO Fetch a list of all consumer tokens accessing the account of the given user. 10 | 11 | BEGIN 12 | 13 | P_RESULT := 0; 14 | 15 | OPEN P_ROWS FOR 16 | SELECT OSR_CONSUMER_KEY "consumer_key", 17 | OSR_CONSUMER_SECRET "consumer_secret", 18 | OSR_ENABLED "enabled", 19 | OSR_STATUS "status", 20 | OSR_APPLICATION_URI "application_uri", 21 | OSR_APPLICATION_TITLE "application_title", 22 | OSR_APPLICATION_DESCR "application_descr", 23 | OST_TIMESTAMP "timestamp", 24 | OST_TOKEN "token", 25 | OST_TOKEN_SECRET "token_secret", 26 | OST_REFERRER_HOST "token_referrer_host", 27 | OSR_CALLBACK_URI "callback_uri" 28 | FROM OAUTH_SERVER_REGISTRY 29 | JOIN OAUTH_SERVER_TOKEN 30 | ON OST_OSR_ID_REF = OSR_ID 31 | WHERE OST_USA_ID_REF = P_USER_ID 32 | AND OST_TOKEN_TYPE = 'ACCESS' 33 | AND OST_TOKEN_TTL >= SYSDATE 34 | ORDER BY OSR_APPLICATION_TITLE; 35 | 36 | 37 | EXCEPTION 38 | WHEN OTHERS THEN 39 | -- CALL THE FUNCTION TO LOG ERRORS 40 | ROLLBACK; 41 | P_RESULT := 1; -- ERROR 42 | END; 43 | / 44 | -------------------------------------------------------------------------------- /vendor-src/oauth-php/library/store/oracle/OracleDB/3_Procedures/SP_LIST_LOG.prc: -------------------------------------------------------------------------------- 1 | CREATE OR REPLACE PROCEDURE SP_LIST_LOG 2 | ( 3 | P_OPTION_FLAG IN NUMBER, -- 0:NULL; 1:OTHERWISE 4 | P_USA_ID IN NUMBER, 5 | P_OSR_CONSUMER_KEY IN VARCHAR2, 6 | P_OCR_CONSUMER_KEY IN VARCHAR2, 7 | P_OST_TOKEN IN VARCHAR2, 8 | P_OCT_TOKEN IN VARCHAR2, 9 | P_ROWS OUT TYPES.REF_CURSOR, 10 | P_RESULT OUT NUMBER 11 | ) 12 | AS 13 | 14 | -- PROCEDURE TO Get a page of entries from the log. Returns the last 100 records 15 | -- matching the options given. 16 | 17 | BEGIN 18 | 19 | P_RESULT := 0; 20 | 21 | IF P_OPTION_FLAG IS NULL OR P_OPTION_FLAG = 0 THEN 22 | OPEN P_ROWS FOR 23 | SELECT * FROM ( 24 | SELECT OLG_ID "olg_id", 25 | OLG_OSR_CONSUMER_KEY "osr_consumer_key", 26 | OLG_OST_TOKEN "ost_token", 27 | OLG_OCR_CONSUMER_KEY "ocr_consumer_key", 28 | OLG_OCT_TOKEN "oct_token", 29 | OLG_USA_ID_REF "user_id", 30 | OLG_RECEIVED "received", 31 | OLG_SENT "sent", 32 | OLG_BASE_STRING "base_string", 33 | OLG_NOTES "notes", 34 | OLG_TIMESTAMP "timestamp", 35 | -- INET_NTOA(OLG_REMOTE_IP) "remote_ip" 36 | OLG_REMOTE_IP "remote_ip" 37 | FROM OAUTH_LOG 38 | WHERE OLG_USA_ID_REF = P_USA_ID 39 | ORDER BY OLG_ID DESC 40 | ) WHERE ROWNUM<=100; 41 | ELSE 42 | OPEN P_ROWS FOR 43 | SELECT * FROM ( 44 | SELECT OLG_ID "olg_id", 45 | OLG_OSR_CONSUMER_KEY "osr_consumer_key", 46 | OLG_OST_TOKEN "ost_token", 47 | OLG_OCR_CONSUMER_KEY "ocr_consumer_key", 48 | OLG_OCT_TOKEN "oct_token", 49 | OLG_USA_ID_REF "user_id", 50 | OLG_RECEIVED "received", 51 | OLG_SENT "sent", 52 | OLG_BASE_STRING "base_string", 53 | OLG_NOTES "notes", 54 | OLG_TIMESTAMP "timestamp", 55 | -- INET_NTOA(OLG_REMOTE_IP) "remote_ip" 56 | OLG_REMOTE_IP "remote_ip" 57 | FROM OAUTH_LOG 58 | WHERE OLG_OSR_CONSUMER_KEY = P_OSR_CONSUMER_KEY 59 | AND OLG_OCR_CONSUMER_KEY = P_OCR_CONSUMER_KEY 60 | AND OLG_OST_TOKEN = P_OST_TOKEN 61 | AND OLG_OCT_TOKEN = P_OCT_TOKEN 62 | AND (OLG_USA_ID_REF IS NULL OR OLG_USA_ID_REF = P_USA_ID) 63 | ORDER BY OLG_ID DESC 64 | ) WHERE ROWNUM<=100; 65 | 66 | END IF; 67 | 68 | 69 | EXCEPTION 70 | WHEN OTHERS THEN 71 | -- CALL THE FUNCTION TO LOG ERRORS 72 | ROLLBACK; 73 | P_RESULT := 1; -- ERROR 74 | END; 75 | / 76 | -------------------------------------------------------------------------------- /vendor-src/oauth-php/library/store/oracle/OracleDB/3_Procedures/SP_LIST_SERVERS.prc: -------------------------------------------------------------------------------- 1 | CREATE OR REPLACE PROCEDURE SP_LIST_SERVERS 2 | ( 3 | P_Q IN VARCHAR2, 4 | P_USER_ID IN NUMBER, 5 | P_ROWS OUT TYPES.REF_CURSOR, 6 | P_RESULT OUT NUMBER 7 | ) 8 | AS 9 | 10 | -- PROCEDURE TO Get a list of all consumers from the consumer registry. 11 | BEGIN 12 | P_RESULT := 0; 13 | 14 | IF P_Q IS NOT NULL THEN 15 | 16 | OPEN P_ROWS FOR 17 | SELECT OCR_ID "id", 18 | OCR_USA_ID_REF "user_id", 19 | OCR_CONSUMER_KEY "consumer_key", 20 | OCR_CONSUMER_SECRET "consumer_secret", 21 | OCR_SIGNATURE_METHODS "signature_methods", 22 | OCR_SERVER_URI "server_uri", 23 | OCR_SERVER_URI_HOST "server_uri_host", 24 | OCR_SERVER_URI_PATH "server_uri_path", 25 | OCR_REQUEST_TOKEN_URI "request_token_uri", 26 | OCR_AUTHORIZE_URI "authorize_uri", 27 | OCR_ACCESS_TOKEN_URI "access_token_uri" 28 | FROM OAUTH_CONSUMER_REGISTRY 29 | WHERE ( OCR_CONSUMER_KEY LIKE '%'|| P_Q ||'%' 30 | OR OCR_SERVER_URI LIKE '%'|| P_Q ||'%' 31 | OR OCR_SERVER_URI_HOST LIKE '%'|| P_Q ||'%' 32 | OR OCR_SERVER_URI_PATH LIKE '%'|| P_Q ||'%') 33 | AND (OCR_USA_ID_REF = P_USER_ID OR OCR_USA_ID_REF IS NULL) 34 | ORDER BY OCR_SERVER_URI_HOST, OCR_SERVER_URI_PATH; 35 | 36 | ELSE 37 | 38 | OPEN P_ROWS FOR 39 | SELECT OCR_ID "id", 40 | OCR_USA_ID_REF "user_id", 41 | OCR_CONSUMER_KEY "consumer_key", 42 | OCR_CONSUMER_SECRET "consumer_secret", 43 | OCR_SIGNATURE_METHODS "signature_methods", 44 | OCR_SERVER_URI "server_uri", 45 | OCR_SERVER_URI_HOST "server_uri_host", 46 | OCR_SERVER_URI_PATH "server_uri_path", 47 | OCR_REQUEST_TOKEN_URI "request_token_uri", 48 | OCR_AUTHORIZE_URI "authorize_uri", 49 | OCR_ACCESS_TOKEN_URI "access_token_uri" 50 | FROM OAUTH_CONSUMER_REGISTRY 51 | WHERE OCR_USA_ID_REF = P_USER_ID OR OCR_USA_ID_REF IS NULL 52 | ORDER BY OCR_SERVER_URI_HOST, OCR_SERVER_URI_PATH; 53 | 54 | END IF; 55 | 56 | 57 | 58 | 59 | 60 | EXCEPTION 61 | WHEN OTHERS THEN 62 | -- CALL THE FUNCTION TO LOG ERRORS 63 | ROLLBACK; 64 | P_RESULT := 1; -- ERROR 65 | END; 66 | / 67 | -------------------------------------------------------------------------------- /vendor-src/oauth-php/library/store/oracle/OracleDB/3_Procedures/SP_LIST_SERVER_TOKENS.prc: -------------------------------------------------------------------------------- 1 | CREATE OR REPLACE PROCEDURE SP_LIST_SERVER_TOKENS 2 | ( 3 | P_USER_ID IN NUMBER, 4 | P_ROWS OUT TYPES.REF_CURSOR, 5 | P_RESULT OUT NUMBER 6 | ) 7 | AS 8 | 9 | -- PROCEDURE TO Find the server details that might be used for a request 10 | BEGIN 11 | P_RESULT := 0; 12 | 13 | OPEN P_ROWS FOR 14 | SELECT OCR_CONSUMER_KEY "consumer_key", 15 | OCR_CONSUMER_SECRET "consumer_secret", 16 | OCT_ID "token_id", 17 | OCT_TOKEN "token", 18 | OCT_TOKEN_SECRET "token_secret", 19 | OCT_USA_ID_REF "user_id", 20 | OCR_SIGNATURE_METHODS "signature_methods", 21 | OCR_SERVER_URI "server_uri", 22 | OCR_SERVER_URI_HOST "server_uri_host", 23 | OCR_SERVER_URI_PATH "server_uri_path", 24 | OCR_REQUEST_TOKEN_URI "request_token_uri", 25 | OCR_AUTHORIZE_URI "authorize_uri", 26 | OCR_ACCESS_TOKEN_URI "access_token_uri", 27 | OCT_TIMESTAMP "timestamp" 28 | FROM OAUTH_CONSUMER_REGISTRY 29 | JOIN OAUTH_CONSUMER_TOKEN 30 | ON OCT_OCR_ID_REF = OCR_ID 31 | WHERE OCT_USA_ID_REF = P_USER_ID 32 | AND OCT_TOKEN_TYPE = 'ACCESS' 33 | AND OCT_TOKEN_TTL >= SYSDATE 34 | ORDER BY OCR_SERVER_URI_HOST, OCR_SERVER_URI_PATH; 35 | 36 | 37 | 38 | 39 | EXCEPTION 40 | WHEN OTHERS THEN 41 | -- CALL THE FUNCTION TO LOG ERRORS 42 | ROLLBACK; 43 | P_RESULT := 1; -- ERROR 44 | END; 45 | / 46 | -------------------------------------------------------------------------------- /vendor-src/oauth-php/library/store/oracle/OracleDB/3_Procedures/SP_SET_CONSUMER_ACC_TOKEN_TTL.prc: -------------------------------------------------------------------------------- 1 | CREATE OR REPLACE PROCEDURE SP_SET_CONSUMER_ACC_TOKEN_TTL 2 | ( 3 | P_TOKEN IN VARCHAR2, 4 | P_TOKEN_TTL IN NUMBER, 5 | P_RESULT OUT NUMBER 6 | ) 7 | AS 8 | 9 | -- PROCEDURE TO Set the ttl of a consumer access token. This is done when the 10 | -- server receives a valid request with a xoauth_token_ttl parameter in it. 11 | 12 | BEGIN 13 | 14 | P_RESULT := 0; 15 | 16 | UPDATE OAUTH_SERVER_TOKEN 17 | SET OST_TOKEN_TTL = SYSDATE + (P_TOKEN_TTL/(24*60*60)) 18 | WHERE OST_TOKEN = P_TOKEN 19 | AND OST_TOKEN_TYPE = 'ACCESS'; 20 | 21 | 22 | EXCEPTION 23 | WHEN OTHERS THEN 24 | -- CALL THE FUNCTION TO LOG ERRORS 25 | ROLLBACK; 26 | P_RESULT := 1; -- ERROR 27 | END; 28 | / 29 | -------------------------------------------------------------------------------- /vendor-src/oauth-php/library/store/oracle/OracleDB/3_Procedures/SP_SET_SERVER_TOKEN_TTL.prc: -------------------------------------------------------------------------------- 1 | CREATE OR REPLACE PROCEDURE SP_SET_SERVER_TOKEN_TTL 2 | ( 3 | P_TOKEN_TTL IN NUMBER, -- IN SECOND 4 | P_CONSUMER_KEY IN VARCHAR2, 5 | P_TOKEN IN VARCHAR2, 6 | P_RESULT OUT NUMBER 7 | ) 8 | AS 9 | 10 | -- PROCEDURE TO Set the ttl of a server access token. 11 | 12 | BEGIN 13 | 14 | P_RESULT := 0; 15 | 16 | 17 | UPDATE OAUTH_CONSUMER_TOKEN 18 | SET OCT_TOKEN_TTL = SYSDATE + (P_TOKEN_TTL/(24*60*60)) -- DATE_ADD(NOW(), INTERVAL %D SECOND) 19 | WHERE OCT_TOKEN = P_TOKEN 20 | AND OCT_OCR_ID_REF IN (SELECT OCR_ID FROM OAUTH_CONSUMER_REGISTRY WHERE OCR_CONSUMER_KEY = P_CONSUMER_KEY); 21 | 22 | 23 | EXCEPTION 24 | WHEN OTHERS THEN 25 | -- CALL THE FUNCTION TO LOG ERRORS 26 | ROLLBACK; 27 | P_RESULT := 1; -- ERROR 28 | END; 29 | / 30 | -------------------------------------------------------------------------------- /vendor-src/oauth-php/library/store/oracle/OracleDB/3_Procedures/SP_UPDATE_CONSUMER.prc: -------------------------------------------------------------------------------- 1 | CREATE OR REPLACE PROCEDURE SP_UPDATE_CONSUMER 2 | ( 3 | P_OSR_USA_ID_REF IN NUMBER, 4 | P_OSR_CONSUMER_KEY IN VARCHAR2, 5 | P_OSR_CONSUMER_SECRET IN VARCHAR2, 6 | P_OSR_REQUESTER_NAME IN VARCHAR2, 7 | P_OSR_REQUESTER_EMAIL IN VARCHAR2, 8 | P_OSR_CALLBACK_URI IN VARCHAR2, 9 | P_OSR_APPLICATION_URI IN VARCHAR2, 10 | P_OSR_APPLICATION_TITLE IN VARCHAR2, 11 | P_OSR_APPLICATION_DESCR IN VARCHAR2, 12 | P_OSR_APPLICATION_NOTES IN VARCHAR2, 13 | P_OSR_APPLICATION_TYPE IN VARCHAR2, 14 | P_OSR_APPLICATION_COMMERCIAL IN INTEGER, 15 | P_RESULT OUT NUMBER 16 | ) 17 | AS 18 | 19 | -- PROCEDURE TO Insert a new consumer with this server (we will be the server) 20 | BEGIN 21 | P_RESULT := 0; 22 | 23 | 24 | INSERT INTO OAUTH_SERVER_REGISTRY 25 | ( OSR_ID, OSR_ENABLED, OSR_STATUS,OSR_USA_ID_REF,OSR_CONSUMER_KEY, OSR_CONSUMER_SECRET,OSR_REQUESTER_NAME, 26 | OSR_REQUESTER_EMAIL, OSR_CALLBACK_URI, OSR_APPLICATION_URI, OSR_APPLICATION_TITLE, OSR_APPLICATION_DESCR, 27 | OSR_APPLICATION_NOTES, OSR_APPLICATION_TYPE, OSR_APPLICATION_COMMERCIAL, OSR_TIMESTAMP, OSR_ISSUE_DATE) 28 | VALUES 29 | ( SEQ_OSR_ID.NEXTVAL, 1, 'ACTIVE', P_OSR_USA_ID_REF, P_OSR_CONSUMER_KEY, P_OSR_CONSUMER_SECRET,P_OSR_REQUESTER_NAME, 30 | P_OSR_REQUESTER_EMAIL, P_OSR_CALLBACK_URI, P_OSR_APPLICATION_URI, P_OSR_APPLICATION_TITLE, P_OSR_APPLICATION_DESCR, 31 | P_OSR_APPLICATION_NOTES, P_OSR_APPLICATION_TYPE, P_OSR_APPLICATION_COMMERCIAL, SYSDATE, SYSDATE); 32 | 33 | 34 | EXCEPTION 35 | WHEN OTHERS THEN 36 | -- CALL THE FUNCTION TO LOG ERRORS 37 | ROLLBACK; 38 | P_RESULT := 1; -- ERROR 39 | END; 40 | / 41 | -------------------------------------------------------------------------------- /vendor-src/oauth-php/library/store/oracle/install.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /vendor-src/oauth-php/test/discovery/xrds-fireeagle.xrds: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | xri://$xrds*simple 8 | 2008-04-15T00:25:30-07:00 9 | 10 | 11 | 12 | http://oauth.net/core/1.0/endpoint/request 13 | 14 | http://oauth.net/core/1.0/parameters/auth-header 15 | http://oauth.net/core/1.0/parameters/post-body 16 | http://oauth.net/core/1.0/parameters/uri-query 17 | http://oauth.net/core/1.0/signature/HMAC-SHA1 18 | http://oauth.net/core/1.0/signature/PLAINTEXT 19 | 20 | https://fireeagle.yahooapis.com/oauth/request_token 21 | 22 | 23 | 24 | 25 | http://oauth.net/core/1.0/endpoint/authorize 26 | 27 | http://oauth.net/core/1.0/parameters/auth-header 28 | http://oauth.net/core/1.0/parameters/uri-query 29 | 30 | https://fireeagle.yahooapis.com/oauth/access_token 31 | 32 | 33 | 34 | 35 | http://oauth.net/core/1.0/endpoint/access 36 | 37 | http://oauth.net/core/1.0/parameters/auth-header 38 | http://oauth.net/core/1.0/parameters/post-body 39 | http://oauth.net/core/1.0/parameters/uri-query 40 | http://oauth.net/core/1.0/signature/HMAC-SHA1 41 | http://oauth.net/core/1.0/signature/PLAINTEXT 42 | 43 | http://fireeagle.yahoo.net/oauth/authorize 44 | 45 | 46 | 47 | 48 | http://oauth.net/core/1.0/endpoint/resource 49 | 50 | http://oauth.net/core/1.0/parameters/auth-header 51 | http://oauth.net/core/1.0/parameters/post-body 52 | http://oauth.net/core/1.0/parameters/uri-query 53 | http://oauth.net/core/1.0/signature/HMAC-SHA1 54 | http://oauth.net/core/1.0/signature/PLAINTEXT 55 | 56 | 57 | 58 | 59 | 60 | 61 | http://oauth.net/discovery/1.0/consumer-identity/oob 62 | https://fireeagle.yahoo.net/developer/create 63 | 64 | 65 | 66 | 67 | 68 | 69 | xri://$xrds*simple 70 | 71 | 72 | 73 | http://oauth.net/discovery/1.0 74 | #oauth 75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /vendor-src/oauth-php/test/discovery/xrds-getsatisfaction.xrds: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | xri://$xrds*simple 6 | 2008-04-30T23:59:59Z 7 | 8 | 9 | 10 | http://oauth.net/core/1.0/endpoint/request 11 | 12 | http://oauth.net/core/1.0/parameters/auth-header 13 | http://oauth.net/core/1.0/signature/HMAC-SHA1 14 | 15 | http://getsatisfaction.com/api/request_token 16 | 17 | 18 | 19 | http://oauth.net/core/1.0/endpoint/authorize 20 | 21 | http://oauth.net/core/1.0/parameters/uri-query 22 | 23 | http://getsatisfaction.com/api/authorize 24 | 25 | 26 | 27 | 28 | http://oauth.net/core/1.0/endpoint/access 29 | 30 | http://oauth.net/core/1.0/parameters/auth-header 31 | http://oauth.net/core/1.0/signature/HMAC-SHA1 32 | 33 | http://getsatisfaction.com/api/access_token 34 | 35 | 36 | 37 | 45 | 46 | http://oauth.net/core/1.0/endpoint/resource 47 | 48 | http://oauth.net/core/1.0/parameters/auth-header 49 | http://oauth.net/core/1.0/signature/HMAC-SHA1 50 | 51 | 52 | 53 | 54 | 55 | 56 | http://oauth.net/discovery/1.0/consumer-identity/oob 57 | http://getsatisfaction.com/me/extensions/new 58 | 59 | 60 | 61 | 62 | 63 | 64 | xri://$xrds*simple 65 | 66 | 67 | 68 | http://oauth.net/discovery/1.0 69 | #oauth 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /vendor-src/oauth-php/test/discovery/xrds-magnolia.xrds: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | xri://$xrds*simple 8 | 2008-04-13T07:34:58Z 9 | 10 | 11 | 12 | http://oauth.net/core/1.0/endpoint/request 13 | 14 | http://oauth.net/core/1.0/parameters/auth-header 15 | http://oauth.net/core/1.0/parameters/post-body 16 | http://oauth.net/core/1.0/parameters/uri-query 17 | http://oauth.net/core/1.0/signature/HMAC-SHA1 18 | http://oauth.net/core/1.0/signature/RSA-SHA1 19 | http://oauth.net/core/1.0/signature/PLAINTEXT 20 | 21 | https://ma.gnolia.com/oauth/get_request_token 22 | 23 | 24 | 25 | 26 | http://oauth.net/core/1.0/endpoint/authorize 27 | 28 | http://oauth.net/core/1.0/parameters/auth-header 29 | http://oauth.net/core/1.0/parameters/uri-query 30 | 31 | https://ma.gnolia.com/oauth/authorize 32 | http://ma.gnolia.com/oauth/authorize 33 | 34 | 35 | 36 | 37 | http://oauth.net/core/1.0/endpoint/access 38 | 39 | http://oauth.net/core/1.0/parameters/auth-header 40 | http://oauth.net/core/1.0/parameters/post-body 41 | http://oauth.net/core/1.0/parameters/uri-query 42 | http://oauth.net/core/1.0/signature/HMAC-SHA1 43 | http://oauth.net/core/1.0/signature/RSA-SHA1 44 | http://oauth.net/core/1.0/signature/PLAINTEXT 45 | 46 | https://ma.gnolia.com/oauth/get_access_token 47 | 48 | 49 | 50 | 51 | http://oauth.net/core/1.0/endpoint/resource 52 | 53 | http://oauth.net/core/1.0/parameters/auth-header 54 | http://oauth.net/core/1.0/parameters/post-body 55 | http://oauth.net/core/1.0/parameters/uri-query 56 | http://oauth.net/core/1.0/signature/HMAC-SHA1 57 | http://oauth.net/core/1.0/signature/RSA-SHA1 58 | 59 | 60 | 61 | 62 | 63 | 64 | http://oauth.net/discovery/1.0/consumer-identity/oob 65 | http://ma.gnolia.com/applications/new 66 | 67 | 68 | 69 | 70 | 71 | 72 | xri://$xrds*simple 73 | 74 | 75 | 76 | http://oauth.net/discovery/1.0 77 | #oauth 78 | 79 | 80 | 81 | --------------------------------------------------------------------------------