Skip to content

Commit 315c771

Browse files
committed
v3.5.0
1 parent eff0808 commit 315c771

File tree

15 files changed

+299
-105
lines changed

15 files changed

+299
-105
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
matrix:
1717
os: [ubuntu-latest]
1818
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
19-
poetry-version: ["2.1.2"]
19+
poetry-version: ["2.1.3"]
2020
steps:
2121
- uses: actions/checkout@v4
2222
- uses: actions/setup-python@v5

docs/additional_info/changelog.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
Changelog
44
=========
55

6+
3.5.0 (08-May-2025)
7+
-------------------
8+
9+
* Added support for `Current contributor <https://developers.lokalise.com/reference/retrieve-me-as-a-contributor>`_ endpoint
10+
* Added support for `Fetch team <https://developers.lokalise.com/reference/get-team-details>`_ endpoint
11+
612
3.4.0 (30-Apr-2025)
713
-------------------
814

docs/api/contributors.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,24 @@ Example:
3636
contributor.email == "test@example.com"
3737
contributor.fullname == "John Doe"
3838
39+
Fetch current contributor
40+
-------------------------
41+
42+
This endpoint returns contributor in the given project based on the user whose token is used to send the request. In other words, it returns information about self in scope of a project.
43+
44+
.. py:function:: current_contributor(project_id)
45+
46+
:param str project_id: ID of the project
47+
:return: Contributor model
48+
49+
Example:
50+
51+
.. code-block:: python
52+
53+
contributor = client.current_contributor('123.abc')
54+
55+
contributor.fullname == "John Doe"
56+
3957
Create one or multiple contributors
4058
-----------------------------------
4159

docs/api/teams.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,22 @@ Example:
1717
1818
teams = client.teams({"page": 2, "limit": 3})
1919
teams.items[0].team_id # => 156123
20+
21+
22+
Fetch a single team
23+
-------------------
24+
25+
.. py:function:: team(team_id)
26+
27+
:param team_id: ID of the team to fetch
28+
:type team_id: int or str
29+
:return: Team model
30+
31+
Example:
32+
33+
.. code-block:: python
34+
35+
team = client.team(12345)
36+
37+
team.team_id # => 12345
38+
team.name # => "My Team"

lokalise/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
This module contains plugin metadata.
55
"""
66

7-
__version__: str = "3.4.0"
7+
__version__: str = "3.5.0"

lokalise/client_methods/contributors.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,17 @@ def contributor(self,
4141
find(parent_id=project_id, resource_id=contributor_id)
4242
return ContributorModel(raw_contributor)
4343

44+
def current_contributor(self,
45+
project_id: str) -> ContributorModel:
46+
"""Fetches current contributor (on per-token basis).
47+
48+
:param str project_id: ID of the project
49+
:return: Contributor model
50+
"""
51+
raw_contributor = self.get_endpoint("contributors"). \
52+
find(parent_id=project_id, resource_id="me")
53+
return ContributorModel(raw_contributor)
54+
4455
def create_contributors(self,
4556
project_id: str,
4657
params: Union[Dict[str, Any], List[Dict]]

lokalise/client_methods/teams.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
44
This module contains API client definition for teams.
55
"""
6-
from typing import Optional, Dict
6+
from typing import Optional, Dict, Union
77
from lokalise.collections.teams import TeamsCollection
8+
from lokalise.models.team import TeamModel
89
from .endpoint_provider import EndpointProviderMixin
910

1011

@@ -21,3 +22,14 @@ def teams(self, params: Optional[Dict] = None) -> TeamsCollection:
2122
"""
2223
raw_teams = self.get_endpoint("teams").all(params=params)
2324
return TeamsCollection(raw_teams)
25+
26+
def team(self, team_id: Union[str, int]) -> TeamModel:
27+
"""Fetches a single team by ID.
28+
29+
:param team_id: ID of the team to fetch
30+
:type team_id: int or str
31+
:return: Team model
32+
"""
33+
raw_project = self.get_endpoint("teams"). \
34+
find(parent_id=team_id)
35+
return TeamModel(raw_project)

lokalise/endpoints/teams_endpoint.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@
99
class TeamsEndpoint(BaseEndpoint):
1010
"""Describes teams endpoint.
1111
"""
12-
PATH = "teams"
12+
PATH = "teams/$parent_id"

lokalise/models/team.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ class TeamModel(BaseModel):
1111
"""Describes team model.
1212
"""
1313

14+
DATA_KEY = 'team'
15+
1416
ATTRS = [
1517
'team_id',
1618
'name',

poetry.lock

Lines changed: 100 additions & 100 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)