Skip to content
This repository was archived by the owner on Aug 28, 2025. It is now read-only.

Commit 9521e11

Browse files
authored
Merge pull request #23 from upwork/v1.2.2
v1.2.2
2 parents 15ba6b6 + e7aa926 commit 9521e11

File tree

3 files changed

+122
-107
lines changed

3 files changed

+122
-107
lines changed

changelog.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
Changelog
66
***************
77

8+
.. _1.2.2:
9+
10+
Version 1.2.2
11+
-------------
12+
* Applications API has moved from v3 to v4
13+
814
.. _1.2.1:
915

1016
Version 1.2.1

upwork/client.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,11 @@ def __init__(self, public_key, secret_key,
132132
self.finreport = Finreports(self)
133133

134134
if hr:
135-
from upwork.routers.hr import HR_V1, HR, HR_V3
135+
from upwork.routers.hr import HR_V1, HR, HR_V3, HR_V4
136136
self.hr_v1 = HR_V1(self)
137137
self.hr = HR(self)
138138
self.hr_v3 = HR_V3(self)
139+
self.hr_v4 = HR_V4(self)
139140

140141
if messages:
141142
from upwork.routers.messages import Messages

upwork/routers/hr.py

Lines changed: 114 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -1029,112 +1029,6 @@ class HR_V3(Namespace):
10291029
api_url = 'hr/'
10301030
version = 3
10311031

1032-
def list_client_applications(self, buyer_team__reference, job_key,
1033-
status=None, profile_key=None,
1034-
agency_team__reference=None,
1035-
order_by=None, page_offset=None,
1036-
page_size=None):
1037-
"""
1038-
List job applications as a client.
1039-
1040-
*Parameters:*
1041-
:buyer_team__reference: The reference ID of the client's team.
1042-
It allows getting applications for a
1043-
specific team. Example: ``34567``.
1044-
Use 'List Teams' API call to get it.
1045-
1046-
:job_key: The job key. It allows getting applications
1047-
for a specific job. Example: ``~01d54a7xxxxx125731``.
1048-
1049-
:status: (optional) The current status of the job application.
1050-
Valid values: ``shortlisted``, ``messaged``,
1051-
``hired``, ``offered``, ``declined``, ``hidden``.
1052-
1053-
:profile_key: (optional) Filters by a specific freelancer's profile key.
1054-
1055-
:agency_team__reference: (optional) The reference ID of the agency.
1056-
1057-
:order_by: (optional) Sorts results in format ``$field_name1;$field_name2;..$field_nameN;AD...A``.
1058-
Here ``A`` resebles ascending order, ``D`` - descending order. Example: ``order_by=created_time;D``.
1059-
1060-
:page_offset: (optional) Number of entries to skip
1061-
1062-
:page_size: (optional: default 20) Page size
1063-
in number of entries
1064-
1065-
"""
1066-
data = {}
1067-
1068-
data['buyer_team__reference'] = buyer_team__reference
1069-
data['job_key'] = job_key
1070-
1071-
if status:
1072-
data['status'] = status
1073-
1074-
if profile_key:
1075-
data['profile_key'] = profile_key
1076-
1077-
if agency_team__reference:
1078-
data['agency_team__reference'] = agency_team__reference
1079-
1080-
if order_by:
1081-
data['order_by'] = order_by
1082-
1083-
data['page'] = '{0};{1}'.format(page_offset, page_size)
1084-
1085-
url = 'clients/applications'
1086-
return self.get(url, data)
1087-
1088-
def get_client_application(self, application_id, buyer_team__reference):
1089-
"""
1090-
Get specific job application as a client.
1091-
1092-
*Parameters:*
1093-
:application_id: Job application reference ID.
1094-
1095-
:buyer_team__reference: The reference ID of the client's team.
1096-
It allows getting applications for a
1097-
specific team. Example: ``34567``.
1098-
Use 'List Teams' API call to get it.
1099-
1100-
"""
1101-
data = {}
1102-
1103-
data['buyer_team__reference'] = buyer_team__reference
1104-
1105-
url = 'clients/applications/{0}'.format(application_id)
1106-
return self.get(url, data)
1107-
1108-
def list_freelancer_applications(self, status=None):
1109-
"""
1110-
List job applications as a freelancer.
1111-
1112-
*Parameters:*
1113-
:status: (optional) The current status of the job application.
1114-
Valid values: ``interviews``, ``invites``, ``active``.
1115-
1116-
"""
1117-
data = {}
1118-
1119-
if status:
1120-
data['status'] = status
1121-
1122-
url = 'contractors/applications'
1123-
return self.get(url, data)
1124-
1125-
def get_freelancer_application(self, application_id):
1126-
"""
1127-
Get specific job application as a freelancer.
1128-
1129-
*Parameters:*
1130-
:application_id: Job application reference ID.
1131-
1132-
"""
1133-
data = {}
1134-
1135-
url = 'contractors/applications/{0}'.format(application_id)
1136-
return self.get(url, data)
1137-
11381032
def create_milestone(self, contract_reference, milestone_description, deposit_amount, due_date=None):
11391033
"""
11401034
Create a milestone.
@@ -1345,3 +1239,117 @@ def get_active_milestone(self, contract_reference):
13451239

13461240
url = 'fp/milestones/statuses/active/contracts/{0}'.format(contract_reference)
13471241
return self.get(url, data)
1242+
1243+
1244+
class HR_V4(Namespace):
1245+
"""
1246+
HR API version 4.
1247+
"""
1248+
api_url = 'hr/'
1249+
version = 4
1250+
1251+
def list_client_applications(self, buyer_team__reference, job_key,
1252+
status=None, profile_key=None,
1253+
agency_team__reference=None,
1254+
order_by=None, page_offset=None,
1255+
page_size=None):
1256+
"""
1257+
List job applications as a client.
1258+
1259+
*Parameters:*
1260+
:buyer_team__reference: The reference ID of the client's team.
1261+
It allows getting applications for a
1262+
specific team. Example: ``34567``.
1263+
Use 'List Teams' API call to get it.
1264+
1265+
:job_key: The job key. It allows getting applications
1266+
for a specific job. Example: ``~01d54a7xxxxx125731``.
1267+
1268+
:status: (optional) The current status of the job application.
1269+
Valid values: ``shortlisted``, ``messaged``,
1270+
``hired``, ``offered``, ``declined``, ``hidden``.
1271+
1272+
:profile_key: (optional) Filters by a specific freelancer's profile key.
1273+
1274+
:agency_team__reference: (optional) The reference ID of the agency.
1275+
1276+
:order_by: (optional) Sorts results in format ``$field_name1;$field_name2;..$field_nameN;AD...A``.
1277+
Here ``A`` resebles ascending order, ``D`` - descending order. Example: ``order_by=created_time;D``.
1278+
1279+
:page_offset: (optional) Number of entries to skip
1280+
1281+
:page_size: (optional: default 20) Page size
1282+
in number of entries
1283+
1284+
"""
1285+
data = {}
1286+
1287+
data['buyer_team__reference'] = buyer_team__reference
1288+
data['job_key'] = job_key
1289+
1290+
if status:
1291+
data['status'] = status
1292+
1293+
if profile_key:
1294+
data['profile_key'] = profile_key
1295+
1296+
if agency_team__reference:
1297+
data['agency_team__reference'] = agency_team__reference
1298+
1299+
if order_by:
1300+
data['order_by'] = order_by
1301+
1302+
data['page'] = '{0};{1}'.format(page_offset, page_size)
1303+
1304+
url = 'clients/applications'
1305+
return self.get(url, data)
1306+
1307+
def get_client_application(self, application_id, buyer_team__reference):
1308+
"""
1309+
Get specific job application as a client.
1310+
1311+
*Parameters:*
1312+
:application_id: Job application reference ID.
1313+
1314+
:buyer_team__reference: The reference ID of the client's team.
1315+
It allows getting applications for a
1316+
specific team. Example: ``34567``.
1317+
Use 'List Teams' API call to get it.
1318+
1319+
"""
1320+
data = {}
1321+
1322+
data['buyer_team__reference'] = buyer_team__reference
1323+
1324+
url = 'clients/applications/{0}'.format(application_id)
1325+
return self.get(url, data)
1326+
1327+
def list_freelancer_applications(self, status=None):
1328+
"""
1329+
List job applications as a freelancer.
1330+
1331+
*Parameters:*
1332+
:status: (optional) The current status of the job application.
1333+
Valid values: ``interviews``, ``invites``, ``active``.
1334+
1335+
"""
1336+
data = {}
1337+
1338+
if status:
1339+
data['status'] = status
1340+
1341+
url = 'contractors/applications'
1342+
return self.get(url, data)
1343+
1344+
def get_freelancer_application(self, application_id):
1345+
"""
1346+
Get specific job application as a freelancer.
1347+
1348+
*Parameters:*
1349+
:application_id: Job application reference ID.
1350+
1351+
"""
1352+
data = {}
1353+
1354+
url = 'contractors/applications/{0}'.format(application_id)
1355+
return self.get(url, data)

0 commit comments

Comments
 (0)