/** * Get Workdiary by Contract * * @param string $contract Contract ID * @param string $date Date * @param array $params (Optional) Parameters * @return object */ public function getByContract($contract, $date, $params = array()) { ApiDebug::p(__FUNCTION__); $response = $this->_client->get('/team/v2/workdiaries/contracts/' . $contract . '/' . $date, $params); ApiDebug::p('found response info', $response); return $response; }
/** * Get Specific User Info * * @param integer $userReference User Reference * @return object */ public function getSpecific($userReference) { ApiDebug::p(__FUNCTION__); $response = $this->_client->get('/hr/v2/users/' . $userReference); ApiDebug::p('found response info', $response); return $response; }
/** * Get Workdiary by Contract * * @param string $contract Contract ID * @param string $fromDate Start date * @param string $tillDate Till date * @param array $params (Optional) Parameters * @return object */ public function getByContract($contract, $fromDate, $tillDate, $params = array()) { ApiDebug::p(__FUNCTION__); $response = $this->_client->get('/team/v2/workdays/contracts/' . $company . '/' . $fromDate . ',' . $tillDate, $params); ApiDebug::p('found response info', $response); return $response; }
/** * Invite to Interview * * @param string $jobKey Job key * @param array $params Parameters * @return object */ public function invite($jobKey, $params) { ApiDebug::p(__FUNCTION__); $response = $this->_client->post('/hr/v1/jobs/' . $jobKey . '/candidates', $params); ApiDebug::p('found response info', $response); return $response; }
/** * Reject an existing Submission * * @param integer Submission ID * @param array $params Parameters * @return object */ public function reject($submissionId, $params) { ApiDebug::p(__FUNCTION__); $response = $this->_client->put('/hr/v3/fp/submissions/' . $submissionId . '/reject', $params); ApiDebug::p('found response info', $response); return $response; }
/** * Get specific application * * @param integer $reference Application reference * @return object */ public function getSpecific($reference) { ApiDebug::p(__FUNCTION__); $response = $this->_client->get('/hr/v3/contractors/applications/' . $reference); ApiDebug::p('found response info', $response); return $response; }
/** * Get by specific user * * @param integer $reference User reference * @return object */ public function getBySpecificUser($reference) { ApiDebug::p(__FUNCTION__); $roles = $this->_client->get('/hr/v2/userroles/' . $reference); ApiDebug::p('found auth info', $roles); return $roles; }
/** * Assign to specific engagement the list of activities * * @param integer $engagement Engagement * @param array $params Parameters * @return object */ public function assignToEngagement($engagement, $params) { ApiDebug::p(__FUNCTION__); $response = $this->_client->put('/tasks/v2/tasks/contracts/' . $engagement, $params); ApiDebug::p('found response info', $response); return $response; }
/** * Run a specific action * * @param integer $reference Offer reference * @param array $params Prameters * @return object */ public function actions($reference, $params) { ApiDebug::p(__FUNCTION__); $response = $this->_client->post('/offers/v1/contractors/actions/' . $reference, $params); ApiDebug::p('found response info', $response); return $response; }
/** * End Contract * * @param integer $reference Contract reference * @param array $params Parameters * @return object */ public function endContract($reference, $params) { ApiDebug::p(__FUNCTION__); $response = $this->_client->delete('/hr/v2/contracts/' . $reference, $params); ApiDebug::p('found response info', $response); return $response; }
/** * Get specific engagement * * @param integer $reference Engagement's reference * @return object */ public function getSpecific($reference) { ApiDebug::p(__FUNCTION__); $engagement = $this->_client->get('/hr/v2/engagements/' . $reference); ApiDebug::p('found response info', $engagement); return $engagement; }
/** * Send offer * * @param array $params Parameters * @return object */ public function makeOffer($params) { ApiDebug::p(__FUNCTION__); $response = $this->_client->post('/offers/v1/clients/offers', $params); ApiDebug::p('found response info', $response); return $response; }
/** * Generate Financial Reports for a Specific Account * * @param integer $entityReference Entity reference * @param array $params Parameters * @return object */ public function getSpecific($entityReference, $params) { ApiDebug::p(__FUNCTION__); $report = $this->_client->get('/finreports/v2/financial_accounts/' . $entityReference, $params); ApiDebug::p('found auth info', $report); return $report; }
/** * Search jobs * * @param array $params (Optional) Parameters * @return object */ public function find($params = array()) { ApiDebug::p(__FUNCTION__); $response = $this->_client->get('/profiles/v2/search/jobs', $params); ApiDebug::p('found response info', $response); return $response; }
/** * My Info * * @return object */ public function getUserInfo() { ApiDebug::p(__FUNCTION__); $info = $this->_client->get('/auth/v1/info'); ApiDebug::p('found auth info', $info); return $info; }
/** * Get specific team or company * * @param string $team Teamroom or company ID * @param array $params (Optional) Parameters * @return object */ public function getSpecific($team, $params = array()) { ApiDebug::p(__FUNCTION__); $response = $this->_client->get('/team/v2/teamrooms/' . $team, $params); ApiDebug::p('found response info', $response); return $response; }
/** * Get Users in Team * * @param integer $teamReference Team reference * @return object */ public function getUsersInTeam($teamReference) { ApiDebug::p(__FUNCTION__); $response = $this->_client->get('/hr/v2/teams/' . $teamReference . '/users'); ApiDebug::p('found response info', $response); return $response; }
/** * Get specific Freelancer Profile * * @param string $key Profile key * @return object */ public function getSpecific($key) { ApiDebug::p(__FUNCTION__); $response = $this->_client->get('/profiles/v1/providers/' . $key); ApiDebug::p('found response info', $response); return $response; }
/** * Get full url, based on global constant * * @param string $url Relative URL * @param string $ep (Optional) Entry point * @static * @access public * @return string */ public static function getFullUrl($url, $ep = null) { ApiDebug::p('create full url, based on global constant'); $name = $ep ? 'UPWORK_BASE_URL_' . strtoupper($ep) : 'UPWORK_BASE_URL'; $fullUrl = constant($name) . $url; ApiDebug::p('url', $fullUrl); return $fullUrl; }
/** * @test */ public function testPrintDebugMessage() { $reflection = new \ReflectionClass('Upwork\\API\\Debug'); $property = $reflection->getProperty('_debug'); $property->setAccessible(true); $helper = new ApiDebug(); $property->setValue($helper, true); $this->assertAttributeEquals(true, '_debug', $helper); ob_start(); ApiDebug::p('test message'); $output = ob_get_contents(); ob_end_clean(); $this->assertContains('test message', $output); $property->setValue($helper, false); }
/** * Delete snapshot by specific contract * * @param string $contractId Contract ID * @param string $ts Timestamp * @return object */ public function deleteByContract($contractId, $ts) { ApiDebug::p(__FUNCTION__); $response = $this->_client->delete('/team/v2/snapshots/contracts/' . $contractId . '/' . $ts); ApiDebug::p('found response info', $response); return $response; }
/** * Generate Earning Reports for a Specific Buyer's Company * * @param integer $buyerCompanyReference Buyer company reference * @param array $params Parameters * @return object */ public function getByBuyersCompany($buyerCompanyReference, $params) { ApiDebug::p(__FUNCTION__); $report = $this->_client->get('/finreports/v2/buyer_companies/' . $buyerCompanyReference . '/earnings', $params); ApiDebug::p('found report info', $report); return $report; }
/** * Unarchive specific oTask/Activity record within a Team * * @param string $company Company ID * @param string $team Team ID * @param string $code Specific code(s) * @return object */ public function unarchiveActivities($company, $team, $code) { ApiDebug::p(__FUNCTION__); $response = $this->_client->put('/otask/v1/tasks/companies/' . $company . '/teams/' . $team . '/unarchive/' . $code); ApiDebug::p('found response info', $response); return $response; }
/** * Get OAuth instance * * @param integer $authType Auth type * @access protected * @return object */ protected function _getOAuthInstance($authType) { ApiDebug::p('get OAuth instance'); $oauth = new \OAuth(self::$_apiKey, self::$_secret, self::$_sigMethod, $authType); if (ApiConfig::get('debug')) { $oauth->enableDebug(); } if (!self::$_verifySsl) { $oauth->disableSSLChecks(); } return $oauth; }
/** * Generating Freelancer Specific Reports (with financial info) * * @param string $freelancerId Freelancer ID * @param array $params Parameters * @return object */ public function getByFreelancerFull($freelancerId, $params) { ApiDebug::p(__FUNCTION__); $report = $this->_client->get('/timereports/v1/providers/' . $freelancerId, $params); ApiDebug::p('found report info', $report); return $report; }
/** * Reply to existend thread * * @param string $username User ID * @param integer $threadId Thread ID * @param array $params Parameters * @access public * @return object */ public function replyToThread($username, $threadId, $params) { ApiDebug::p(__FUNCTION__); $response = $this->_client->post('/mc/v1/threads/' . $username . '/' . $threadId, $params); ApiDebug::p('found response', $response); return $response; }
/** * Get reasons * * @param array $params Parameters * @return object */ public function getReasons($params) { ApiDebug::p(__FUNCTION__); $response = $this->_client->get('/profiles/v1/metadata/reasons', $params); ApiDebug::p('found response info', $response); return $response; }
/** * Delete an existing Milestone * * @param integer $milestoneId Milestone ID * @return object */ public function delete($milestoneId) { ApiDebug::p(__FUNCTION__); $response = $this->_client->delete('/hr/v3/fp/milestones/' . $milestoneId); ApiDebug::p('found response info', $response); return $response; }
/** * Delete existend job * * @param string $key Job key * @param array $params Parameters * @return object */ public function deleteJob($key, $params) { ApiDebug::p(__FUNCTION__); $job = $this->_client->delete('/hr/v2/jobs/' . $key, $params); ApiDebug::p('found response info', $job); return $job; }
/** * Get OAuth instance * * @param integer $authType (Optional) Auth type * @access protected * @return object */ protected function _getOAuthInstance($authType = null) { ApiDebug::p('get OAuth instance'); $options = array('consumer_key' => self::$_apiKey, 'consumer_secret' => self::$_secret, 'server_uri' => UPWORK_BASE_URL, 'request_token_uri' => ApiUtils::getFullUrl(self::URL_RTOKEN, 'api'), 'authorize_uri' => self::URL_AUTH, 'access_token_uri' => ApiUtils::getFullUrl(self::URL_ATOKEN, 'api')); $oauth = \OAuthStore::instance('Session', $options); return $oauth; }