dubidoc 0.1.3__py3-none-any.whl → 0.2.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
dubidoc/__init__.py CHANGED
@@ -2,6 +2,6 @@
2
2
 
3
3
  __author__ = 'Dmytro Litvinov'
4
4
  __email__ = 'me@dmytrolitvinov.com'
5
- __version__ = '0.1.3'
5
+ __version__ = '0.2.0'
6
6
 
7
7
  from .client import DubidocAPIClient
@@ -4,4 +4,5 @@ from .device import *
4
4
  from .document import *
5
5
  from .document_link import *
6
6
  from .download import *
7
+ from .organization import *
7
8
  from .participant import *
@@ -1 +1,22 @@
1
- # TODO
1
+ from dubidoc.enum import HttpMethod
2
+
3
+
4
+ __all__ = ('OrganizationAPI',)
5
+
6
+
7
+ class OrganizationAPI:
8
+ PATH = 'organizations'
9
+
10
+ def __init__(self, client):
11
+ self.client = client
12
+
13
+ def list(self):
14
+ return self.client.make_request(HttpMethod.GET, self.PATH)
15
+
16
+ def get(self, document_id):
17
+ path = f'{self.PATH}/{document_id}'
18
+ return self.client.make_request(HttpMethod.GET, path)
19
+
20
+ def edit(self, document_id, body):
21
+ path = f'{self.PATH}/{document_id}'
22
+ return self.client.make_request(HttpMethod.PUT, path, body)
dubidoc/client.py CHANGED
@@ -12,6 +12,7 @@ from dubidoc._modules import (
12
12
  DocumentLinkAPI,
13
13
  ParticipantAPI,
14
14
  DownloadAPI,
15
+ OrganizationAPI,
15
16
  )
16
17
  from dubidoc.enum import HttpMethod
17
18
  from dubidoc.response import DubidocAPIResponse
@@ -32,9 +33,10 @@ class DubidocAPIClient:
32
33
  'user-agent': f'python-dubidoc/{__version__} | (https://github.com/DmytroLitvinov/python-dubidoc)',
33
34
  }
34
35
 
35
- def __init__(self, api_token: str, environment: str = 'stage'):
36
+ def __init__(self, api_token: str, organization_uuid: str = '', *, is_stage_env: bool = False):
36
37
  self.api_token = api_token
37
- if environment == 'stage':
38
+ self.organization_uuid = organization_uuid
39
+ if is_stage_env:
38
40
  self.base_url = 'https://docs-stage.navkolo.one'
39
41
  else:
40
42
  self.base_url = 'https://my.dubidoc.com.ua'
@@ -50,8 +52,9 @@ class DubidocAPIClient:
50
52
  self.document_link_api = self._get_module(DocumentLinkAPI)
51
53
  self.participant_api = self._get_module(ParticipantAPI)
52
54
  self.download_api = self._get_module(DownloadAPI)
55
+ self.organization_api = self._get_module(OrganizationAPI)
53
56
 
54
- if environment == 'stage':
57
+ if is_stage_env == 'stage':
55
58
  self.access_token_api = self._get_module(AccessTokenAPI)
56
59
  self.authentication_api = self._get_module(AuthenticationAPI)
57
60
  self.device_api = self._get_module(DeviceAPI)
@@ -62,7 +65,7 @@ class DubidocAPIClient:
62
65
 
63
66
  def _get_headers(self):
64
67
  headers = self.DEFAULT_HEADERS.copy()
65
- headers.update({'X-Access-Token': f'{self.api_token}'})
68
+ headers.update({'X-Access-Token': f'{self.api_token}', 'X-Organization': self.organization_uuid})
66
69
  return headers
67
70
 
68
71
  def _get_module(self, cls):
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: dubidoc
3
- Version: 0.1.3
3
+ Version: 0.2.0
4
4
  Summary: Python SDK for dubidoc.com.ua API
5
5
  Maintainer-email: Dmytro Litvinov <me@dmytrolitvinov.com>
6
6
  License: MIT License
@@ -26,6 +26,7 @@ Requires-Python: >=3.8
26
26
  Description-Content-Type: text/markdown
27
27
  License-File: LICENSE
28
28
  Requires-Dist: requests
29
+ Dynamic: license-file
29
30
 
30
31
  # Dubidoc API client ✍
31
32
 
@@ -67,7 +68,7 @@ api_token = 'xxxxxxxxxxxxxxx'
67
68
  dubidoc = DubidocAPIClient(api_token)
68
69
 
69
70
  documents = dubidoc.document_api.list()
70
- print(documents)
71
+ print(documents.data, documents.response_code)
71
72
  ```
72
73
 
73
74
  ## License
@@ -1,20 +1,20 @@
1
- dubidoc/__init__.py,sha256=6l4n2dkEYCl6u_S0UaTouCrFrPSez64EBrHDeSNz3Ps,177
2
- dubidoc/client.py,sha256=UXRt6IykV-Pc9r9GCQv3xrAZP8VieIVcNz0CnbKG7yg,3216
1
+ dubidoc/__init__.py,sha256=vAc_lGMcAGT01BIQZlgP8YfUM6K0nWT3vnRW7mXH6S8,177
2
+ dubidoc/client.py,sha256=S1B4hQcd-01xiV5CEFUJYzBRNhgAhqtgAtLx_qJ_utk,3419
3
3
  dubidoc/enum.py,sha256=RTIS0WplquZrFTqZGtzkc95i_9jqu2Xvl6j0SFXZ72I,120
4
4
  dubidoc/response.py,sha256=8k2GkMW2F5FX4U2TGJPfJD-_UE6DA4c1FGGQL_Vzr-E,133
5
- dubidoc/_modules/__init__.py,sha256=NUeLh3Onke4cs4BGkowtqbaBByLVh_tEqtXNtacKI2w,184
5
+ dubidoc/_modules/__init__.py,sha256=EhIZnTrKGt_Wk1HQtA5Bb0e2eK2Bs2AOWRwI2EdXAjw,212
6
6
  dubidoc/_modules/access_token.py,sha256=nHyYWWg95SJkifvlgtr9I_h7jPTcdpcgxORukdjwwBU,1018
7
7
  dubidoc/_modules/authentication.py,sha256=AtIyTjtwdgT1nHBQkgqfvQsJvZ-T0qqK0epKi-TwGVE,1465
8
8
  dubidoc/_modules/device.py,sha256=ItrK-wzZVEAXPIWbTUkTsYl1JHZLSSAAAHFuKbgw2MU,976
9
9
  dubidoc/_modules/document.py,sha256=-SmWvQPN8r8jQGYFTm99bHhXmAOMF2kBJV96Ue8slV4,1947
10
10
  dubidoc/_modules/document_link.py,sha256=dHultZvqbPW3VxCspdUnzfBgmOPUzSgjeeuyAyA4H_I,515
11
11
  dubidoc/_modules/download.py,sha256=foTua0_sFpGrwObwgOr6HPen4ngFrJOhGdsCqPUCjnI,608
12
- dubidoc/_modules/organization.py,sha256=DkeLUlrb7rGx3nZ04aADU9HXXu5mZTf_DBwT0xhzIv4,7
12
+ dubidoc/_modules/organization.py,sha256=wIyWuiGz5vA091wHmwYZHY31jD0pf_uqUdPX-soRiek,562
13
13
  dubidoc/_modules/organization_user.py,sha256=DkeLUlrb7rGx3nZ04aADU9HXXu5mZTf_DBwT0xhzIv4,7
14
14
  dubidoc/_modules/participant.py,sha256=AJ60D7cokQNQFFeUWCngWvx-NQl6VuG-YarREAW9HtE,811
15
15
  dubidoc/_modules/storecode.py,sha256=DkeLUlrb7rGx3nZ04aADU9HXXu5mZTf_DBwT0xhzIv4,7
16
- dubidoc-0.1.3.dist-info/LICENSE,sha256=wYGgsJKkNcLDvJQfbrT5HabzSp3imJCmSpCOS8_pu9o,1072
17
- dubidoc-0.1.3.dist-info/METADATA,sha256=TnzKpuPPfjbpy8IiwTHGJrzcPuIvPXXa9mJbE8SkeyA,3018
18
- dubidoc-0.1.3.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
19
- dubidoc-0.1.3.dist-info/top_level.txt,sha256=SQKT6uKBzQCmsVr8MCszUFz4WYCc5Oq7wvy5Y-ZReU0,8
20
- dubidoc-0.1.3.dist-info/RECORD,,
16
+ dubidoc-0.2.0.dist-info/licenses/LICENSE,sha256=wYGgsJKkNcLDvJQfbrT5HabzSp3imJCmSpCOS8_pu9o,1072
17
+ dubidoc-0.2.0.dist-info/METADATA,sha256=fiQzCa0TbR4G-tLFh6SdyxS1t6BZeuym8II4-fxn6S4,3070
18
+ dubidoc-0.2.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
19
+ dubidoc-0.2.0.dist-info/top_level.txt,sha256=SQKT6uKBzQCmsVr8MCszUFz4WYCc5Oq7wvy5Y-ZReU0,8
20
+ dubidoc-0.2.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (74.1.2)
2
+ Generator: setuptools (80.9.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5