├── .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 |