Skip to content

Commit cda61a1

Browse files
committed
feat(legacy): deprecate calls to legacy api
1 parent dc045de commit cda61a1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+123
-2065
lines changed

CHANGES.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Release History
22

3+
## 2.5.0
4+
* Remove calls to the legacy APIs
5+
36
## 2.4.3
47
* Fix - Update refresh_token when doing Refresh Token Grant flow
58

README.md

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,7 @@ This project provides a set of resources of Upwork API from http://developers.up
1212
based on OAuth 2.0.
1313

1414
# Features
15-
These are the supported API resources:
16-
17-
* My Info
18-
* Custom Payments
19-
* Hiring
20-
* Job and Freelancer Profile
21-
* Search Jobs and Freelancers
22-
* Organization
23-
* Messages
24-
* Time and Financial Reporting
25-
* Metadata
26-
* Snapshot
27-
* Team
28-
* Work Diary
29-
* Activities
15+
The library supports all GraphQL calls, which are publicly shared at Upwork
3016

3117
# License
3218

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"name": "upwork/php-upwork-oauth2",
33
"description": "PHP bindings for Upwork API (OAuth2)",
4-
"version": "v2.4.3",
4+
"version": "v2.5.0",
55
"type": "library",
66
"keywords": ["upwork", "php", "api", "oauth2"],
77
"homepage": "http://www.upwork.com",
8-
"time": "2024-06-09",
8+
"time": "2024-11-26",
99
"license": "Apache-2.0",
1010
"authors": [
1111
{

src/Upwork/API/Routers/Auth.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
use Upwork\API\Debug as ApiDebug;
1717
use Upwork\API\Client as ApiClient;
18+
use Upwork\API\ApiException as ApiException;
1819

1920
/**
2021
* My Info
@@ -50,10 +51,6 @@ public function __construct(ApiClient $client)
5051
public function getUserInfo()
5152
{
5253
ApiDebug::p(__FUNCTION__);
53-
54-
$info = $this->_client->get('/auth/v1/info');
55-
ApiDebug::p('found auth info', $info);
56-
57-
return $info;
54+
throw new ApiException('The legacy API was deprecated. Please, use GraphQL call - see example in this library.');
5855
}
5956
}

src/Upwork/API/Routers/Freelancers/Profile.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
use Upwork\API\Debug as ApiDebug;
1717
use Upwork\API\Client as ApiClient;
18+
use Upwork\API\ApiException as ApiException;
1819

1920
/**
2021
* Freelancer Profile
@@ -51,10 +52,6 @@ public function __construct(ApiClient $client)
5152
public function getSpecific($key)
5253
{
5354
ApiDebug::p(__FUNCTION__);
54-
55-
$response = $this->_client->get('/profiles/v1/providers/' . $key);
56-
ApiDebug::p('found response info', $response);
57-
58-
return $response;
55+
throw new ApiException('The legacy API was deprecated. Please, use GraphQL call - see example in this library.');
5956
}
6057
}

src/Upwork/API/Routers/Freelancers/Search.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
use Upwork\API\Debug as ApiDebug;
1717
use Upwork\API\Client as ApiClient;
18+
use Upwork\API\ApiException as ApiException;
1819

1920
/**
2021
* Search Freelancers
@@ -51,10 +52,6 @@ public function __construct(ApiClient $client)
5152
public function find($params = array())
5253
{
5354
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;
55+
throw new ApiException('The legacy API was deprecated. Please, use GraphQL call - see example in this library.');
5956
}
6057
}

src/Upwork/API/Routers/Hr/Clients/Applications.php

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
use Upwork\API\Debug as ApiDebug;
1717
use Upwork\API\Client as ApiClient;
18+
use Upwork\API\ApiException as ApiException;
1819

1920
/**
2021
* Client Job Applications API
@@ -51,11 +52,7 @@ public function __construct(ApiClient $client)
5152
public function getList($params)
5253
{
5354
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;
55+
throw new ApiException('The legacy API was deprecated. Please, use GraphQL call - see example in this library.');
5956
}
6057

6158
/**
@@ -68,10 +65,6 @@ public function getList($params)
6865
public function getSpecific($reference, $params)
6966
{
7067
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;
68+
throw new ApiException('The legacy API was deprecated. Please, use GraphQL call - see example in this library.');
7669
}
7770
}

src/Upwork/API/Routers/Hr/Clients/Offers.php

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
use Upwork\API\Debug as ApiDebug;
1717
use Upwork\API\Client as ApiClient;
18+
use Upwork\API\ApiException as ApiException;
1819

1920
/**
2021
* Client Job Offers API
@@ -51,11 +52,7 @@ public function __construct(ApiClient $client)
5152
public function getList($params)
5253
{
5354
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;
55+
throw new ApiException('The legacy API was deprecated. Please, use GraphQL call - see example in this library.');
5956
}
6057

6158
/**
@@ -68,11 +65,7 @@ public function getList($params)
6865
public function getSpecific($reference, $params)
6966
{
7067
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;
68+
throw new ApiException('The legacy API was deprecated. Please, use GraphQL call - see example in this library.');
7669
}
7770

7871
/**
@@ -84,10 +77,6 @@ public function getSpecific($reference, $params)
8477
public function makeOffer($params)
8578
{
8679
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;
80+
throw new ApiException('The legacy API was deprecated. Please, use GraphQL call - see example in this library.');
9281
}
9382
}

src/Upwork/API/Routers/Hr/Contracts.php

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
use Upwork\API\Debug as ApiDebug;
1717
use Upwork\API\Client as ApiClient;
18+
use Upwork\API\ApiException as ApiException;
1819

1920
/**
2021
* Contracts API
@@ -52,11 +53,7 @@ public function __construct(ApiClient $client)
5253
public function suspendContract($reference, $params)
5354
{
5455
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;
56+
throw new ApiException('The legacy API was deprecated. Please, use GraphQL call - see example in this library.');
6057
}
6158

6259
/**
@@ -69,11 +66,7 @@ public function suspendContract($reference, $params)
6966
public function restartContract($reference, $params)
7067
{
7168
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;
69+
throw new ApiException('The legacy API was deprecated. Please, use GraphQL call - see example in this library.');
7770
}
7871

7972
/**
@@ -86,10 +79,6 @@ public function restartContract($reference, $params)
8679
public function endContract($reference, $params)
8780
{
8881
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;
82+
throw new ApiException('The legacy API was deprecated. Please, use GraphQL call - see example in this library.');
9483
}
9584
}

src/Upwork/API/Routers/Hr/Engagements.php

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
use Upwork\API\Debug as ApiDebug;
1717
use Upwork\API\Client as ApiClient;
18+
use Upwork\API\ApiException as ApiException;
1819

1920
/**
2021
* Engagements API
@@ -51,11 +52,7 @@ public function __construct(ApiClient $client)
5152
public function getList($params)
5253
{
5354
ApiDebug::p(__FUNCTION__);
54-
55-
$engagements = $this->_client->get('/hr/v2/engagements', $params);
56-
ApiDebug::p('found response info', $engagements);
57-
58-
return $engagements;
55+
throw new ApiException('The legacy API was deprecated. Please, use GraphQL call - see example in this library.');
5956
}
6057

6158
/**
@@ -67,10 +64,6 @@ public function getList($params)
6764
public function getSpecific($reference)
6865
{
6966
ApiDebug::p(__FUNCTION__);
70-
71-
$engagement = $this->_client->get('/hr/v2/engagements/' . $reference);
72-
ApiDebug::p('found response info', $engagement);
73-
74-
return $engagement;
67+
throw new ApiException('The legacy API was deprecated. Please, use GraphQL call - see example in this library.');
7568
}
7669
}

0 commit comments

Comments
 (0)