Skip to content

Commit f669def

Browse files
committed
SDK regeneration
1 parent 6019235 commit f669def

File tree

7 files changed

+5918
-5896
lines changed

7 files changed

+5918
-5896
lines changed

README.md

Lines changed: 61 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,24 @@ pip install MergePythonClient
1919

2020
A full reference for this library is available [here](https://github.com/merge-api/merge-python-client/blob/HEAD/./reference.md).
2121

22+
## Usage
23+
24+
Instantiate and use the client with the following:
25+
26+
```python
27+
from merge import Merge
28+
from merge.resources.ats import ActivityRequest
29+
30+
client = Merge(
31+
account_token="YOUR_ACCOUNT_TOKEN",
32+
api_key="YOUR_API_KEY",
33+
)
34+
client.ats.activities.create(
35+
model=ActivityRequest(),
36+
remote_user_id="remote_user_id",
37+
)
38+
```
39+
2240
## Instantiation
2341

2442
```python
@@ -42,24 +60,6 @@ client.ats. # APIs specific to the ATS Category
4260
client.hris. # APIs specific to the HRIS Category
4361
```
4462

45-
## Usage
46-
47-
Instantiate and use the client with the following:
48-
49-
```python
50-
from merge import Merge
51-
from merge.resources.ats import ActivityRequest
52-
53-
client = Merge(
54-
account_token="YOUR_ACCOUNT_TOKEN",
55-
api_key="YOUR_API_KEY",
56-
)
57-
client.ats.activities.create(
58-
model=ActivityRequest(),
59-
remote_user_id="remote_user_id",
60-
)
61-
```
62-
6363
## Async Client
6464

6565
The SDK also exports an `async` client so that you can make non-blocking calls to our API.
@@ -101,49 +101,6 @@ except ApiError as e:
101101
print(e.body)
102102
```
103103

104-
## File Download
105-
106-
```python
107-
import merge
108-
from merge.client import Merge
109-
110-
merge_client = Merge(
111-
api_key="<YOUR_API_KEY>",
112-
account_token="<YOUR_ACCOUNT_TOKEN>")
113-
114-
files = merge_client.filestorage.files.list(name="<FILE_NAME>").results
115-
116-
id = files[0].id
117-
name = files[0].name
118-
local_filename = f"<LOCAL_FILE_PATH>/{name}"
119-
120-
response = merge_client.filestorage.files.download_retrieve(id=id)
121-
with open(local_filename, "wb") as f:
122-
for chunk in response:
123-
f.write(chunk)
124-
```
125-
126-
## Pagination
127-
128-
The SDK may return paginated results. Endpoints that return paginated results will
129-
include a `next` and `prev` property on the response. To get the next page, you can
130-
pass in the value of `next` to the cursor property on the request. Similarly, to
131-
get the previous page, you can pass in the value of `prev` to the cursor property on
132-
the request.
133-
134-
Below is an example of iterating over all pages:
135-
```python
136-
137-
# response contains the first page
138-
response = merge_client.hris.employees.list(created_after="2030-01-01")
139-
140-
# if there is a next page, load it by passing `next` to the cursor argument
141-
while response.next is not None:
142-
response = hris_client.employees.list(
143-
cursor=response.next,
144-
created_after="2030-01-01")
145-
```
146-
147104
## Advanced
148105

149106
### Access Raw Response Data
@@ -229,3 +186,46 @@ a proof of concept, but know that we will not be able to merge it as-is. We sugg
229186
an issue first to discuss with us!
230187

231188
On the other hand, contributions to the README are always very welcome!
189+
## File Download
190+
191+
```python
192+
import merge
193+
from merge.client import Merge
194+
195+
merge_client = Merge(
196+
api_key="<YOUR_API_KEY>",
197+
account_token="<YOUR_ACCOUNT_TOKEN>")
198+
199+
files = merge_client.filestorage.files.list(name="<FILE_NAME>").results
200+
201+
id = files[0].id
202+
name = files[0].name
203+
local_filename = f"<LOCAL_FILE_PATH>/{name}"
204+
205+
response = merge_client.filestorage.files.download_retrieve(id=id)
206+
with open(local_filename, "wb") as f:
207+
for chunk in response:
208+
f.write(chunk)
209+
```
210+
211+
## Pagination
212+
213+
The SDK may return paginated results. Endpoints that return paginated results will
214+
include a `next` and `prev` property on the response. To get the next page, you can
215+
pass in the value of `next` to the cursor property on the request. Similarly, to
216+
get the previous page, you can pass in the value of `prev` to the cursor property on
217+
the request.
218+
219+
Below is an example of iterating over all pages:
220+
```python
221+
222+
# response contains the first page
223+
response = merge_client.hris.employees.list(created_after="2030-01-01")
224+
225+
# if there is a next page, load it by passing `next` to the cursor argument
226+
while response.next is not None:
227+
response = hris_client.employees.list(
228+
cursor=response.next,
229+
created_after="2030-01-01")
230+
```
231+

poetry.lock

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

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "MergePythonClient"
33

44
[tool.poetry]
55
name = "MergePythonClient"
6-
version = "2.0.0"
6+
version = "2.1.0"
77
description = ""
88
readme = "README.md"
99
authors = []
@@ -37,7 +37,7 @@ Repository = 'https://github.com/merge-api/merge-python-client'
3737
python = "^3.8"
3838
httpx = ">=0.21.2"
3939
pydantic = ">= 1.9.2"
40-
pydantic-core = "^2.18.2"
40+
pydantic-core = ">=2.18.2"
4141
typing_extensions = ">= 4.0.0"
4242

4343
[tool.poetry.group.dev.dependencies]

0 commit comments

Comments
 (0)