pebbenote-cli 0.6.1__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.
- pebbenote_cli/__init__.py +0 -0
- pebbenote_cli/__main__.py +3 -0
- pebbenote_cli/api.py +62 -0
- pebbenote_cli/auth.py +120 -0
- pebbenote_cli/cli.py +282 -0
- pebbenote_cli/client/__init__.py +8 -0
- pebbenote_cli/client/api/__init__.py +1 -0
- pebbenote_cli/client/api/actions/__init__.py +1 -0
- pebbenote_cli/client/api/actions/apply_action.py +166 -0
- pebbenote_cli/client/api/instructions/__init__.py +1 -0
- pebbenote_cli/client/api/instructions/list_instructions.py +127 -0
- pebbenote_cli/client/api/instructions/replace_instructions.py +204 -0
- pebbenote_cli/client/api/notes/__init__.py +1 -0
- pebbenote_cli/client/api/notes/create_note.py +173 -0
- pebbenote_cli/client/api/notes/delete_note.py +159 -0
- pebbenote_cli/client/api/notes/edit_note_by_id.py +197 -0
- pebbenote_cli/client/api/notes/get_note_by_id.py +184 -0
- pebbenote_cli/client/api/notes/list_notes.py +132 -0
- pebbenote_cli/client/api/notes/set_default_note.py +161 -0
- pebbenote_cli/client/api/sharing/__init__.py +1 -0
- pebbenote_cli/client/api/sharing/get_note_sharing.py +161 -0
- pebbenote_cli/client/api/sharing/get_shared_note.py +172 -0
- pebbenote_cli/client/api/sharing/join_shared_note.py +176 -0
- pebbenote_cli/client/api/sharing/make_note_private.py +167 -0
- pebbenote_cli/client/api/sharing/remove_note_member.py +173 -0
- pebbenote_cli/client/api/sharing/revoke_share_link.py +181 -0
- pebbenote_cli/client/api/sharing/share_note.py +202 -0
- pebbenote_cli/client/client.py +280 -0
- pebbenote_cli/client/errors.py +16 -0
- pebbenote_cli/client/models/__init__.py +47 -0
- pebbenote_cli/client/models/action_accepted_model.py +68 -0
- pebbenote_cli/client/models/action_edit_model.py +96 -0
- pebbenote_cli/client/models/action_model.py +105 -0
- pebbenote_cli/client/models/action_status.py +10 -0
- pebbenote_cli/client/models/http_validation_error.py +79 -0
- pebbenote_cli/client/models/instructions_conflict_model.py +75 -0
- pebbenote_cli/client/models/instructions_edit_model.py +69 -0
- pebbenote_cli/client/models/instructions_model.py +69 -0
- pebbenote_cli/client/models/note_access.py +10 -0
- pebbenote_cli/client/models/note_conflict_model.py +75 -0
- pebbenote_cli/client/models/note_member_model.py +86 -0
- pebbenote_cli/client/models/note_model.py +113 -0
- pebbenote_cli/client/models/note_sharing_model.py +94 -0
- pebbenote_cli/client/models/note_update_model.py +83 -0
- pebbenote_cli/client/models/note_view_model.py +143 -0
- pebbenote_cli/client/models/share_access.py +9 -0
- pebbenote_cli/client/models/share_create_model.py +69 -0
- pebbenote_cli/client/models/share_link_model.py +120 -0
- pebbenote_cli/client/models/shared_note_model.py +89 -0
- pebbenote_cli/client/models/validation_error.py +125 -0
- pebbenote_cli/client/models/validation_error_context.py +44 -0
- pebbenote_cli/client/types.py +54 -0
- pebbenote_cli/config.py +46 -0
- pebbenote_cli/editor.py +23 -0
- pebbenote_cli/errors.py +10 -0
- pebbenote_cli/http.py +36 -0
- pebbenote_cli/instructions.py +24 -0
- pebbenote_cli/merge.py +79 -0
- pebbenote_cli-0.6.1.dist-info/METADATA +129 -0
- pebbenote_cli-0.6.1.dist-info/RECORD +62 -0
- pebbenote_cli-0.6.1.dist-info/WHEEL +4 -0
- pebbenote_cli-0.6.1.dist-info/entry_points.txt +3 -0
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from ... import errors
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...models.instructions_model import InstructionsModel
|
|
9
|
+
from ...types import Response
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def _get_kwargs() -> dict[str, Any]:
|
|
13
|
+
_kwargs: dict[str, Any] = {
|
|
14
|
+
"method": "get",
|
|
15
|
+
"url": "/api/instruction/",
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return _kwargs
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def _parse_response(
|
|
22
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
23
|
+
) -> InstructionsModel | None:
|
|
24
|
+
if response.status_code == 200:
|
|
25
|
+
response_200 = InstructionsModel.from_dict(response.json())
|
|
26
|
+
|
|
27
|
+
return response_200
|
|
28
|
+
|
|
29
|
+
if client.raise_on_unexpected_status:
|
|
30
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
31
|
+
else:
|
|
32
|
+
return None
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def _build_response(
|
|
36
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
37
|
+
) -> Response[InstructionsModel]:
|
|
38
|
+
return Response(
|
|
39
|
+
status_code=HTTPStatus(response.status_code),
|
|
40
|
+
content=response.content,
|
|
41
|
+
headers=response.headers,
|
|
42
|
+
parsed=_parse_response(client=client, response=response),
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def sync_detailed(
|
|
47
|
+
*,
|
|
48
|
+
client: AuthenticatedClient,
|
|
49
|
+
) -> Response[InstructionsModel]:
|
|
50
|
+
"""List Instructions
|
|
51
|
+
|
|
52
|
+
Raises:
|
|
53
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
54
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
55
|
+
|
|
56
|
+
Returns:
|
|
57
|
+
Response[InstructionsModel]
|
|
58
|
+
"""
|
|
59
|
+
|
|
60
|
+
kwargs = _get_kwargs()
|
|
61
|
+
|
|
62
|
+
response = client.get_httpx_client().request(
|
|
63
|
+
**kwargs,
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
return _build_response(client=client, response=response)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def sync(
|
|
70
|
+
*,
|
|
71
|
+
client: AuthenticatedClient,
|
|
72
|
+
) -> InstructionsModel | None:
|
|
73
|
+
"""List Instructions
|
|
74
|
+
|
|
75
|
+
Raises:
|
|
76
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
77
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
78
|
+
|
|
79
|
+
Returns:
|
|
80
|
+
InstructionsModel
|
|
81
|
+
"""
|
|
82
|
+
|
|
83
|
+
return sync_detailed(
|
|
84
|
+
client=client,
|
|
85
|
+
).parsed
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
async def asyncio_detailed(
|
|
89
|
+
*,
|
|
90
|
+
client: AuthenticatedClient,
|
|
91
|
+
) -> Response[InstructionsModel]:
|
|
92
|
+
"""List Instructions
|
|
93
|
+
|
|
94
|
+
Raises:
|
|
95
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
96
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
97
|
+
|
|
98
|
+
Returns:
|
|
99
|
+
Response[InstructionsModel]
|
|
100
|
+
"""
|
|
101
|
+
|
|
102
|
+
kwargs = _get_kwargs()
|
|
103
|
+
|
|
104
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
105
|
+
|
|
106
|
+
return _build_response(client=client, response=response)
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
async def asyncio(
|
|
110
|
+
*,
|
|
111
|
+
client: AuthenticatedClient,
|
|
112
|
+
) -> InstructionsModel | None:
|
|
113
|
+
"""List Instructions
|
|
114
|
+
|
|
115
|
+
Raises:
|
|
116
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
117
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
118
|
+
|
|
119
|
+
Returns:
|
|
120
|
+
InstructionsModel
|
|
121
|
+
"""
|
|
122
|
+
|
|
123
|
+
return (
|
|
124
|
+
await asyncio_detailed(
|
|
125
|
+
client=client,
|
|
126
|
+
)
|
|
127
|
+
).parsed
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from ... import errors
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...models.http_validation_error import HTTPValidationError
|
|
9
|
+
from ...models.instructions_conflict_model import InstructionsConflictModel
|
|
10
|
+
from ...models.instructions_edit_model import InstructionsEditModel
|
|
11
|
+
from ...models.instructions_model import InstructionsModel
|
|
12
|
+
from ...types import UNSET, Response, Unset
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def _get_kwargs(
|
|
16
|
+
*,
|
|
17
|
+
body: InstructionsEditModel,
|
|
18
|
+
apply: bool | Unset = True,
|
|
19
|
+
) -> dict[str, Any]:
|
|
20
|
+
headers: dict[str, Any] = {}
|
|
21
|
+
|
|
22
|
+
params: dict[str, Any] = {}
|
|
23
|
+
|
|
24
|
+
params["apply"] = apply
|
|
25
|
+
|
|
26
|
+
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
|
27
|
+
|
|
28
|
+
_kwargs: dict[str, Any] = {
|
|
29
|
+
"method": "put",
|
|
30
|
+
"url": "/api/instruction/",
|
|
31
|
+
"params": params,
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
_kwargs["json"] = body.to_dict()
|
|
35
|
+
|
|
36
|
+
headers["Content-Type"] = "application/json"
|
|
37
|
+
|
|
38
|
+
_kwargs["headers"] = headers
|
|
39
|
+
return _kwargs
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def _parse_response(
|
|
43
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
44
|
+
) -> HTTPValidationError | InstructionsConflictModel | InstructionsModel | None:
|
|
45
|
+
if response.status_code == 200:
|
|
46
|
+
response_200 = InstructionsModel.from_dict(response.json())
|
|
47
|
+
|
|
48
|
+
return response_200
|
|
49
|
+
|
|
50
|
+
if response.status_code == 409:
|
|
51
|
+
response_409 = InstructionsConflictModel.from_dict(response.json())
|
|
52
|
+
|
|
53
|
+
return response_409
|
|
54
|
+
|
|
55
|
+
if response.status_code == 422:
|
|
56
|
+
response_422 = HTTPValidationError.from_dict(response.json())
|
|
57
|
+
|
|
58
|
+
return response_422
|
|
59
|
+
|
|
60
|
+
if client.raise_on_unexpected_status:
|
|
61
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
62
|
+
else:
|
|
63
|
+
return None
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def _build_response(
|
|
67
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
68
|
+
) -> Response[HTTPValidationError | InstructionsConflictModel | InstructionsModel]:
|
|
69
|
+
return Response(
|
|
70
|
+
status_code=HTTPStatus(response.status_code),
|
|
71
|
+
content=response.content,
|
|
72
|
+
headers=response.headers,
|
|
73
|
+
parsed=_parse_response(client=client, response=response),
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def sync_detailed(
|
|
78
|
+
*,
|
|
79
|
+
client: AuthenticatedClient,
|
|
80
|
+
body: InstructionsEditModel,
|
|
81
|
+
apply: bool | Unset = True,
|
|
82
|
+
) -> Response[HTTPValidationError | InstructionsConflictModel | InstructionsModel]:
|
|
83
|
+
"""Replace Instructions
|
|
84
|
+
|
|
85
|
+
Replaces the standing instructions. Unless `apply` is false, the new ones
|
|
86
|
+
are then applied in the background to every note the user owns.
|
|
87
|
+
|
|
88
|
+
Args:
|
|
89
|
+
apply (bool | Unset): Default: True.
|
|
90
|
+
body (InstructionsEditModel):
|
|
91
|
+
|
|
92
|
+
Raises:
|
|
93
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
94
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
95
|
+
|
|
96
|
+
Returns:
|
|
97
|
+
Response[HTTPValidationError | InstructionsConflictModel | InstructionsModel]
|
|
98
|
+
"""
|
|
99
|
+
|
|
100
|
+
kwargs = _get_kwargs(
|
|
101
|
+
body=body,
|
|
102
|
+
apply=apply,
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
response = client.get_httpx_client().request(
|
|
106
|
+
**kwargs,
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
return _build_response(client=client, response=response)
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
def sync(
|
|
113
|
+
*,
|
|
114
|
+
client: AuthenticatedClient,
|
|
115
|
+
body: InstructionsEditModel,
|
|
116
|
+
apply: bool | Unset = True,
|
|
117
|
+
) -> HTTPValidationError | InstructionsConflictModel | InstructionsModel | None:
|
|
118
|
+
"""Replace Instructions
|
|
119
|
+
|
|
120
|
+
Replaces the standing instructions. Unless `apply` is false, the new ones
|
|
121
|
+
are then applied in the background to every note the user owns.
|
|
122
|
+
|
|
123
|
+
Args:
|
|
124
|
+
apply (bool | Unset): Default: True.
|
|
125
|
+
body (InstructionsEditModel):
|
|
126
|
+
|
|
127
|
+
Raises:
|
|
128
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
129
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
130
|
+
|
|
131
|
+
Returns:
|
|
132
|
+
HTTPValidationError | InstructionsConflictModel | InstructionsModel
|
|
133
|
+
"""
|
|
134
|
+
|
|
135
|
+
return sync_detailed(
|
|
136
|
+
client=client,
|
|
137
|
+
body=body,
|
|
138
|
+
apply=apply,
|
|
139
|
+
).parsed
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
async def asyncio_detailed(
|
|
143
|
+
*,
|
|
144
|
+
client: AuthenticatedClient,
|
|
145
|
+
body: InstructionsEditModel,
|
|
146
|
+
apply: bool | Unset = True,
|
|
147
|
+
) -> Response[HTTPValidationError | InstructionsConflictModel | InstructionsModel]:
|
|
148
|
+
"""Replace Instructions
|
|
149
|
+
|
|
150
|
+
Replaces the standing instructions. Unless `apply` is false, the new ones
|
|
151
|
+
are then applied in the background to every note the user owns.
|
|
152
|
+
|
|
153
|
+
Args:
|
|
154
|
+
apply (bool | Unset): Default: True.
|
|
155
|
+
body (InstructionsEditModel):
|
|
156
|
+
|
|
157
|
+
Raises:
|
|
158
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
159
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
160
|
+
|
|
161
|
+
Returns:
|
|
162
|
+
Response[HTTPValidationError | InstructionsConflictModel | InstructionsModel]
|
|
163
|
+
"""
|
|
164
|
+
|
|
165
|
+
kwargs = _get_kwargs(
|
|
166
|
+
body=body,
|
|
167
|
+
apply=apply,
|
|
168
|
+
)
|
|
169
|
+
|
|
170
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
171
|
+
|
|
172
|
+
return _build_response(client=client, response=response)
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
async def asyncio(
|
|
176
|
+
*,
|
|
177
|
+
client: AuthenticatedClient,
|
|
178
|
+
body: InstructionsEditModel,
|
|
179
|
+
apply: bool | Unset = True,
|
|
180
|
+
) -> HTTPValidationError | InstructionsConflictModel | InstructionsModel | None:
|
|
181
|
+
"""Replace Instructions
|
|
182
|
+
|
|
183
|
+
Replaces the standing instructions. Unless `apply` is false, the new ones
|
|
184
|
+
are then applied in the background to every note the user owns.
|
|
185
|
+
|
|
186
|
+
Args:
|
|
187
|
+
apply (bool | Unset): Default: True.
|
|
188
|
+
body (InstructionsEditModel):
|
|
189
|
+
|
|
190
|
+
Raises:
|
|
191
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
192
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
193
|
+
|
|
194
|
+
Returns:
|
|
195
|
+
HTTPValidationError | InstructionsConflictModel | InstructionsModel
|
|
196
|
+
"""
|
|
197
|
+
|
|
198
|
+
return (
|
|
199
|
+
await asyncio_detailed(
|
|
200
|
+
client=client,
|
|
201
|
+
body=body,
|
|
202
|
+
apply=apply,
|
|
203
|
+
)
|
|
204
|
+
).parsed
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Contains endpoint functions for accessing the API"""
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from ... import errors
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...models.http_validation_error import HTTPValidationError
|
|
9
|
+
from ...models.note_model import NoteModel
|
|
10
|
+
from ...types import UNSET, Response
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def _get_kwargs(
|
|
14
|
+
*,
|
|
15
|
+
content: str,
|
|
16
|
+
) -> dict[str, Any]:
|
|
17
|
+
params: dict[str, Any] = {}
|
|
18
|
+
|
|
19
|
+
params["content"] = content
|
|
20
|
+
|
|
21
|
+
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
|
22
|
+
|
|
23
|
+
_kwargs: dict[str, Any] = {
|
|
24
|
+
"method": "post",
|
|
25
|
+
"url": "/api/note/",
|
|
26
|
+
"params": params,
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return _kwargs
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def _parse_response(
|
|
33
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
34
|
+
) -> HTTPValidationError | NoteModel | None:
|
|
35
|
+
if response.status_code == 200:
|
|
36
|
+
response_200 = NoteModel.from_dict(response.json())
|
|
37
|
+
|
|
38
|
+
return response_200
|
|
39
|
+
|
|
40
|
+
if response.status_code == 422:
|
|
41
|
+
response_422 = HTTPValidationError.from_dict(response.json())
|
|
42
|
+
|
|
43
|
+
return response_422
|
|
44
|
+
|
|
45
|
+
if client.raise_on_unexpected_status:
|
|
46
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
47
|
+
else:
|
|
48
|
+
return None
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def _build_response(
|
|
52
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
53
|
+
) -> Response[HTTPValidationError | NoteModel]:
|
|
54
|
+
return Response(
|
|
55
|
+
status_code=HTTPStatus(response.status_code),
|
|
56
|
+
content=response.content,
|
|
57
|
+
headers=response.headers,
|
|
58
|
+
parsed=_parse_response(client=client, response=response),
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def sync_detailed(
|
|
63
|
+
*,
|
|
64
|
+
client: AuthenticatedClient,
|
|
65
|
+
content: str,
|
|
66
|
+
) -> Response[HTTPValidationError | NoteModel]:
|
|
67
|
+
"""Create Note
|
|
68
|
+
|
|
69
|
+
The note gets a title in the background
|
|
70
|
+
|
|
71
|
+
Args:
|
|
72
|
+
content (str):
|
|
73
|
+
|
|
74
|
+
Raises:
|
|
75
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
76
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
77
|
+
|
|
78
|
+
Returns:
|
|
79
|
+
Response[HTTPValidationError | NoteModel]
|
|
80
|
+
"""
|
|
81
|
+
|
|
82
|
+
kwargs = _get_kwargs(
|
|
83
|
+
content=content,
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
response = client.get_httpx_client().request(
|
|
87
|
+
**kwargs,
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
return _build_response(client=client, response=response)
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
def sync(
|
|
94
|
+
*,
|
|
95
|
+
client: AuthenticatedClient,
|
|
96
|
+
content: str,
|
|
97
|
+
) -> HTTPValidationError | NoteModel | None:
|
|
98
|
+
"""Create Note
|
|
99
|
+
|
|
100
|
+
The note gets a title in the background
|
|
101
|
+
|
|
102
|
+
Args:
|
|
103
|
+
content (str):
|
|
104
|
+
|
|
105
|
+
Raises:
|
|
106
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
107
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
108
|
+
|
|
109
|
+
Returns:
|
|
110
|
+
HTTPValidationError | NoteModel
|
|
111
|
+
"""
|
|
112
|
+
|
|
113
|
+
return sync_detailed(
|
|
114
|
+
client=client,
|
|
115
|
+
content=content,
|
|
116
|
+
).parsed
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
async def asyncio_detailed(
|
|
120
|
+
*,
|
|
121
|
+
client: AuthenticatedClient,
|
|
122
|
+
content: str,
|
|
123
|
+
) -> Response[HTTPValidationError | NoteModel]:
|
|
124
|
+
"""Create Note
|
|
125
|
+
|
|
126
|
+
The note gets a title in the background
|
|
127
|
+
|
|
128
|
+
Args:
|
|
129
|
+
content (str):
|
|
130
|
+
|
|
131
|
+
Raises:
|
|
132
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
133
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
134
|
+
|
|
135
|
+
Returns:
|
|
136
|
+
Response[HTTPValidationError | NoteModel]
|
|
137
|
+
"""
|
|
138
|
+
|
|
139
|
+
kwargs = _get_kwargs(
|
|
140
|
+
content=content,
|
|
141
|
+
)
|
|
142
|
+
|
|
143
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
144
|
+
|
|
145
|
+
return _build_response(client=client, response=response)
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
async def asyncio(
|
|
149
|
+
*,
|
|
150
|
+
client: AuthenticatedClient,
|
|
151
|
+
content: str,
|
|
152
|
+
) -> HTTPValidationError | NoteModel | None:
|
|
153
|
+
"""Create Note
|
|
154
|
+
|
|
155
|
+
The note gets a title in the background
|
|
156
|
+
|
|
157
|
+
Args:
|
|
158
|
+
content (str):
|
|
159
|
+
|
|
160
|
+
Raises:
|
|
161
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
162
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
163
|
+
|
|
164
|
+
Returns:
|
|
165
|
+
HTTPValidationError | NoteModel
|
|
166
|
+
"""
|
|
167
|
+
|
|
168
|
+
return (
|
|
169
|
+
await asyncio_detailed(
|
|
170
|
+
client=client,
|
|
171
|
+
content=content,
|
|
172
|
+
)
|
|
173
|
+
).parsed
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any, cast
|
|
3
|
+
from urllib.parse import quote
|
|
4
|
+
from uuid import UUID
|
|
5
|
+
|
|
6
|
+
import httpx
|
|
7
|
+
|
|
8
|
+
from ... import errors
|
|
9
|
+
from ...client import AuthenticatedClient, Client
|
|
10
|
+
from ...models.http_validation_error import HTTPValidationError
|
|
11
|
+
from ...types import Response
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def _get_kwargs(
|
|
15
|
+
note_id: UUID,
|
|
16
|
+
) -> dict[str, Any]:
|
|
17
|
+
_kwargs: dict[str, Any] = {
|
|
18
|
+
"method": "delete",
|
|
19
|
+
"url": "/api/note/{note_id}".format(
|
|
20
|
+
note_id=quote(str(note_id), safe=""),
|
|
21
|
+
),
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return _kwargs
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def _parse_response(
|
|
28
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
29
|
+
) -> Any | HTTPValidationError | None:
|
|
30
|
+
if response.status_code == 204:
|
|
31
|
+
response_204 = cast(Any, None)
|
|
32
|
+
return response_204
|
|
33
|
+
|
|
34
|
+
if response.status_code == 422:
|
|
35
|
+
response_422 = HTTPValidationError.from_dict(response.json())
|
|
36
|
+
|
|
37
|
+
return response_422
|
|
38
|
+
|
|
39
|
+
if client.raise_on_unexpected_status:
|
|
40
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
41
|
+
else:
|
|
42
|
+
return None
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def _build_response(
|
|
46
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
47
|
+
) -> Response[Any | HTTPValidationError]:
|
|
48
|
+
return Response(
|
|
49
|
+
status_code=HTTPStatus(response.status_code),
|
|
50
|
+
content=response.content,
|
|
51
|
+
headers=response.headers,
|
|
52
|
+
parsed=_parse_response(client=client, response=response),
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def sync_detailed(
|
|
57
|
+
note_id: UUID,
|
|
58
|
+
*,
|
|
59
|
+
client: AuthenticatedClient,
|
|
60
|
+
) -> Response[Any | HTTPValidationError]:
|
|
61
|
+
"""Delete Note
|
|
62
|
+
|
|
63
|
+
Args:
|
|
64
|
+
note_id (UUID):
|
|
65
|
+
|
|
66
|
+
Raises:
|
|
67
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
68
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
69
|
+
|
|
70
|
+
Returns:
|
|
71
|
+
Response[Any | HTTPValidationError]
|
|
72
|
+
"""
|
|
73
|
+
|
|
74
|
+
kwargs = _get_kwargs(
|
|
75
|
+
note_id=note_id,
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
response = client.get_httpx_client().request(
|
|
79
|
+
**kwargs,
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
return _build_response(client=client, response=response)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def sync(
|
|
86
|
+
note_id: UUID,
|
|
87
|
+
*,
|
|
88
|
+
client: AuthenticatedClient,
|
|
89
|
+
) -> Any | HTTPValidationError | None:
|
|
90
|
+
"""Delete Note
|
|
91
|
+
|
|
92
|
+
Args:
|
|
93
|
+
note_id (UUID):
|
|
94
|
+
|
|
95
|
+
Raises:
|
|
96
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
97
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
98
|
+
|
|
99
|
+
Returns:
|
|
100
|
+
Any | HTTPValidationError
|
|
101
|
+
"""
|
|
102
|
+
|
|
103
|
+
return sync_detailed(
|
|
104
|
+
note_id=note_id,
|
|
105
|
+
client=client,
|
|
106
|
+
).parsed
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
async def asyncio_detailed(
|
|
110
|
+
note_id: UUID,
|
|
111
|
+
*,
|
|
112
|
+
client: AuthenticatedClient,
|
|
113
|
+
) -> Response[Any | HTTPValidationError]:
|
|
114
|
+
"""Delete Note
|
|
115
|
+
|
|
116
|
+
Args:
|
|
117
|
+
note_id (UUID):
|
|
118
|
+
|
|
119
|
+
Raises:
|
|
120
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
121
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
122
|
+
|
|
123
|
+
Returns:
|
|
124
|
+
Response[Any | HTTPValidationError]
|
|
125
|
+
"""
|
|
126
|
+
|
|
127
|
+
kwargs = _get_kwargs(
|
|
128
|
+
note_id=note_id,
|
|
129
|
+
)
|
|
130
|
+
|
|
131
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
132
|
+
|
|
133
|
+
return _build_response(client=client, response=response)
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
async def asyncio(
|
|
137
|
+
note_id: UUID,
|
|
138
|
+
*,
|
|
139
|
+
client: AuthenticatedClient,
|
|
140
|
+
) -> Any | HTTPValidationError | None:
|
|
141
|
+
"""Delete Note
|
|
142
|
+
|
|
143
|
+
Args:
|
|
144
|
+
note_id (UUID):
|
|
145
|
+
|
|
146
|
+
Raises:
|
|
147
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
148
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
149
|
+
|
|
150
|
+
Returns:
|
|
151
|
+
Any | HTTPValidationError
|
|
152
|
+
"""
|
|
153
|
+
|
|
154
|
+
return (
|
|
155
|
+
await asyncio_detailed(
|
|
156
|
+
note_id=note_id,
|
|
157
|
+
client=client,
|
|
158
|
+
)
|
|
159
|
+
).parsed
|