Skip to content
This repository was archived by the owner on Aug 28, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
Changelog
***************

.. _1.2.2:

Version 1.2.2
-------------
* Applications API has moved from v3 to v4

.. _1.2.1:

Version 1.2.1
Expand Down
3 changes: 2 additions & 1 deletion upwork/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,11 @@ def __init__(self, public_key, secret_key,
self.finreport = Finreports(self)

if hr:
from upwork.routers.hr import HR_V1, HR, HR_V3
from upwork.routers.hr import HR_V1, HR, HR_V3, HR_V4
self.hr_v1 = HR_V1(self)
self.hr = HR(self)
self.hr_v3 = HR_V3(self)
self.hr_v4 = HR_V4(self)

if messages:
from upwork.routers.messages import Messages
Expand Down
220 changes: 114 additions & 106 deletions upwork/routers/hr.py
Original file line number Diff line number Diff line change
Expand Up @@ -1029,112 +1029,6 @@ class HR_V3(Namespace):
api_url = 'hr/'
version = 3

def list_client_applications(self, buyer_team__reference, job_key,
status=None, profile_key=None,
agency_team__reference=None,
order_by=None, page_offset=None,
page_size=None):
"""
List job applications as a client.

*Parameters:*
:buyer_team__reference: The reference ID of the client's team.
It allows getting applications for a
specific team. Example: ``34567``.
Use 'List Teams' API call to get it.

:job_key: The job key. It allows getting applications
for a specific job. Example: ``~01d54a7xxxxx125731``.

:status: (optional) The current status of the job application.
Valid values: ``shortlisted``, ``messaged``,
``hired``, ``offered``, ``declined``, ``hidden``.

:profile_key: (optional) Filters by a specific freelancer's profile key.

:agency_team__reference: (optional) The reference ID of the agency.

:order_by: (optional) Sorts results in format ``$field_name1;$field_name2;..$field_nameN;AD...A``.
Here ``A`` resebles ascending order, ``D`` - descending order. Example: ``order_by=created_time;D``.

:page_offset: (optional) Number of entries to skip

:page_size: (optional: default 20) Page size
in number of entries

"""
data = {}

data['buyer_team__reference'] = buyer_team__reference
data['job_key'] = job_key

if status:
data['status'] = status

if profile_key:
data['profile_key'] = profile_key

if agency_team__reference:
data['agency_team__reference'] = agency_team__reference

if order_by:
data['order_by'] = order_by

data['page'] = '{0};{1}'.format(page_offset, page_size)

url = 'clients/applications'
return self.get(url, data)

def get_client_application(self, application_id, buyer_team__reference):
"""
Get specific job application as a client.

*Parameters:*
:application_id: Job application reference ID.

:buyer_team__reference: The reference ID of the client's team.
It allows getting applications for a
specific team. Example: ``34567``.
Use 'List Teams' API call to get it.

"""
data = {}

data['buyer_team__reference'] = buyer_team__reference

url = 'clients/applications/{0}'.format(application_id)
return self.get(url, data)

def list_freelancer_applications(self, status=None):
"""
List job applications as a freelancer.

*Parameters:*
:status: (optional) The current status of the job application.
Valid values: ``interviews``, ``invites``, ``active``.

"""
data = {}

if status:
data['status'] = status

url = 'contractors/applications'
return self.get(url, data)

def get_freelancer_application(self, application_id):
"""
Get specific job application as a freelancer.

*Parameters:*
:application_id: Job application reference ID.

"""
data = {}

url = 'contractors/applications/{0}'.format(application_id)
return self.get(url, data)

def create_milestone(self, contract_reference, milestone_description, deposit_amount, due_date=None):
"""
Create a milestone.
Expand Down Expand Up @@ -1345,3 +1239,117 @@ def get_active_milestone(self, contract_reference):

url = 'fp/milestones/statuses/active/contracts/{0}'.format(contract_reference)
return self.get(url, data)


class HR_V4(Namespace):
"""
HR API version 4.
"""
api_url = 'hr/'
version = 4

def list_client_applications(self, buyer_team__reference, job_key,
status=None, profile_key=None,
agency_team__reference=None,
order_by=None, page_offset=None,
page_size=None):
"""
List job applications as a client.

*Parameters:*
:buyer_team__reference: The reference ID of the client's team.
It allows getting applications for a
specific team. Example: ``34567``.
Use 'List Teams' API call to get it.

:job_key: The job key. It allows getting applications
for a specific job. Example: ``~01d54a7xxxxx125731``.

:status: (optional) The current status of the job application.
Valid values: ``shortlisted``, ``messaged``,
``hired``, ``offered``, ``declined``, ``hidden``.

:profile_key: (optional) Filters by a specific freelancer's profile key.

:agency_team__reference: (optional) The reference ID of the agency.

:order_by: (optional) Sorts results in format ``$field_name1;$field_name2;..$field_nameN;AD...A``.
Here ``A`` resebles ascending order, ``D`` - descending order. Example: ``order_by=created_time;D``.

:page_offset: (optional) Number of entries to skip

:page_size: (optional: default 20) Page size
in number of entries

"""
data = {}

data['buyer_team__reference'] = buyer_team__reference
data['job_key'] = job_key

if status:
data['status'] = status

if profile_key:
data['profile_key'] = profile_key

if agency_team__reference:
data['agency_team__reference'] = agency_team__reference

if order_by:
data['order_by'] = order_by

data['page'] = '{0};{1}'.format(page_offset, page_size)

url = 'clients/applications'
return self.get(url, data)

def get_client_application(self, application_id, buyer_team__reference):
"""
Get specific job application as a client.

*Parameters:*
:application_id: Job application reference ID.

:buyer_team__reference: The reference ID of the client's team.
It allows getting applications for a
specific team. Example: ``34567``.
Use 'List Teams' API call to get it.

"""
data = {}

data['buyer_team__reference'] = buyer_team__reference

url = 'clients/applications/{0}'.format(application_id)
return self.get(url, data)

def list_freelancer_applications(self, status=None):
"""
List job applications as a freelancer.

*Parameters:*
:status: (optional) The current status of the job application.
Valid values: ``interviews``, ``invites``, ``active``.

"""
data = {}

if status:
data['status'] = status

url = 'contractors/applications'
return self.get(url, data)

def get_freelancer_application(self, application_id):
"""
Get specific job application as a freelancer.

*Parameters:*
:application_id: Job application reference ID.

"""
data = {}

url = 'contractors/applications/{0}'.format(application_id)
return self.get(url, data)