66from typing import Any , Optional , Union , Dict , Callable , List
77import importlib
88from lokalise .utils import snake_to_camel
9+ from .base_client import BaseClient
910from .collections .branches import BranchesCollection
1011from .collections .comments import CommentsCollection
1112from .collections .contributors import ContributorsCollection
3031from .models .branch import BranchModel
3132from .models .comment import CommentModel
3233from .models .contributor import ContributorModel
34+ from .models .jwt import JwtModel
3335from .models .key import KeyModel
3436from .models .language import LanguageModel
3537from .models .order import OrderModel
4951from .models .team_user_billing_details import TeamUsersBillingDetailsModel
5052
5153
52- class Client :
54+ class Client ( BaseClient ) :
5355 """Client used to send API requests.
5456
5557 Usage:
@@ -59,30 +61,6 @@ class Client:
5961 client.projects()
6062 """
6163
62- def __init__ (self ,
63- token : str ,
64- connect_timeout : Optional [Union [int , float ]] = None ,
65- read_timeout : Optional [Union [int , float ]] = None ,
66- enable_compression : Optional [bool ] = False ) -> None :
67- """Instantiate a new Lokalise API client.
68-
69- :param str token: Your Lokalise API token.
70- :param connect_timeout: (optional) Server connection timeout
71- (the value is in seconds). By default, the client will wait indefinitely.
72- :type connect_timeout: int or float
73- :param read_timeout: (optional) Server read timeout
74- (the value is in seconds). By default, the client will wait indefinitely.
75- :type read_timeout: int or float
76- :param enable_compression: (optional) Whether to enable gzip compression.
77- By default it's off.
78- :type enable_compression: bool
79- """
80- self .token = token
81- self .connect_timeout = connect_timeout
82- self .read_timeout = read_timeout
83- self .enable_compression = enable_compression
84- self .token_header = 'X-Api-Token'
85-
8664 def reset_client (self ) -> None :
8765 """Resets the API client by clearing all attributes.
8866 """
@@ -413,6 +391,14 @@ def delete_file(self, project_id: str,
413391 delete (parent_id = project_id , resource_id = file_id )
414392 return response
415393
394+ def jwt (self ) -> JwtModel :
395+ """Fetches OTA JWT.
396+
397+ :return: JWT model
398+ """
399+ raw_jwt = self .get_endpoint ("jwt" ).find ()
400+ return JwtModel (raw_jwt )
401+
416402 def keys (self ,
417403 project_id : str ,
418404 params : Optional [Dict [str , Any ]] = None
0 commit comments