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