hindsight-client 0.3.0__py3-none-any.whl → 0.4.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 (89) hide show
  1. hindsight_client/__init__.py +9 -8
  2. hindsight_client/hindsight_client.py +394 -59
  3. {hindsight_client-0.3.0.dist-info → hindsight_client-0.4.1.dist-info}/METADATA +1 -1
  4. hindsight_client-0.4.1.dist-info/RECORD +89 -0
  5. hindsight_client_api/__init__.py +26 -2
  6. hindsight_client_api/api/__init__.py +2 -0
  7. hindsight_client_api/api/banks_api.py +998 -132
  8. hindsight_client_api/api/directives_api.py +1619 -0
  9. hindsight_client_api/api/documents_api.py +1 -1
  10. hindsight_client_api/api/entities_api.py +10 -7
  11. hindsight_client_api/api/memory_api.py +1 -1
  12. hindsight_client_api/api/mental_models_api.py +1897 -0
  13. hindsight_client_api/api/monitoring_api.py +247 -1
  14. hindsight_client_api/api/operations_api.py +351 -5
  15. hindsight_client_api/api_client.py +1 -1
  16. hindsight_client_api/configuration.py +2 -2
  17. hindsight_client_api/exceptions.py +1 -1
  18. hindsight_client_api/models/__init__.py +23 -1
  19. hindsight_client_api/models/add_background_request.py +3 -3
  20. hindsight_client_api/models/async_operation_submit_response.py +89 -0
  21. hindsight_client_api/models/background_response.py +11 -4
  22. hindsight_client_api/models/bank_list_item.py +7 -7
  23. hindsight_client_api/models/bank_list_response.py +1 -1
  24. hindsight_client_api/models/bank_profile_response.py +12 -5
  25. hindsight_client_api/models/bank_stats_response.py +16 -5
  26. hindsight_client_api/models/budget.py +1 -1
  27. hindsight_client_api/models/cancel_operation_response.py +1 -1
  28. hindsight_client_api/models/chunk_data.py +1 -1
  29. hindsight_client_api/models/chunk_include_options.py +1 -1
  30. hindsight_client_api/models/chunk_response.py +1 -1
  31. hindsight_client_api/models/consolidation_response.py +89 -0
  32. hindsight_client_api/models/create_bank_request.py +9 -2
  33. hindsight_client_api/models/create_directive_request.py +95 -0
  34. hindsight_client_api/models/create_mental_model_request.py +100 -0
  35. hindsight_client_api/models/create_mental_model_response.py +87 -0
  36. hindsight_client_api/models/delete_document_response.py +1 -1
  37. hindsight_client_api/models/delete_response.py +1 -1
  38. hindsight_client_api/models/directive_list_response.py +95 -0
  39. hindsight_client_api/models/directive_response.py +113 -0
  40. hindsight_client_api/models/disposition_traits.py +1 -1
  41. hindsight_client_api/models/document_response.py +1 -1
  42. hindsight_client_api/models/entity_detail_response.py +1 -1
  43. hindsight_client_api/models/entity_include_options.py +1 -1
  44. hindsight_client_api/models/entity_input.py +1 -1
  45. hindsight_client_api/models/entity_list_item.py +1 -1
  46. hindsight_client_api/models/entity_list_response.py +1 -1
  47. hindsight_client_api/models/entity_observation_response.py +1 -1
  48. hindsight_client_api/models/entity_state_response.py +1 -1
  49. hindsight_client_api/models/features_info.py +91 -0
  50. hindsight_client_api/models/graph_data_response.py +1 -1
  51. hindsight_client_api/models/http_validation_error.py +1 -1
  52. hindsight_client_api/models/include_options.py +1 -1
  53. hindsight_client_api/models/list_documents_response.py +1 -1
  54. hindsight_client_api/models/list_memory_units_response.py +1 -1
  55. hindsight_client_api/models/list_tags_response.py +1 -1
  56. hindsight_client_api/models/memory_item.py +1 -1
  57. hindsight_client_api/models/mental_model_list_response.py +95 -0
  58. hindsight_client_api/models/mental_model_response.py +126 -0
  59. hindsight_client_api/models/mental_model_trigger.py +87 -0
  60. hindsight_client_api/models/operation_response.py +2 -2
  61. hindsight_client_api/models/operation_status_response.py +131 -0
  62. hindsight_client_api/models/operations_list_response.py +9 -3
  63. hindsight_client_api/models/recall_request.py +1 -1
  64. hindsight_client_api/models/recall_response.py +1 -1
  65. hindsight_client_api/models/recall_result.py +1 -1
  66. hindsight_client_api/models/reflect_based_on.py +115 -0
  67. hindsight_client_api/models/reflect_directive.py +91 -0
  68. hindsight_client_api/models/reflect_fact.py +1 -1
  69. hindsight_client_api/models/reflect_include_options.py +14 -3
  70. hindsight_client_api/models/reflect_llm_call.py +89 -0
  71. hindsight_client_api/models/reflect_mental_model.py +96 -0
  72. hindsight_client_api/models/reflect_request.py +1 -1
  73. hindsight_client_api/models/reflect_response.py +24 -12
  74. hindsight_client_api/models/reflect_tool_call.py +100 -0
  75. hindsight_client_api/models/reflect_trace.py +105 -0
  76. hindsight_client_api/models/retain_request.py +1 -1
  77. hindsight_client_api/models/retain_response.py +1 -1
  78. hindsight_client_api/models/tag_item.py +1 -1
  79. hindsight_client_api/models/token_usage.py +1 -1
  80. hindsight_client_api/models/tool_calls_include_options.py +87 -0
  81. hindsight_client_api/models/update_directive_request.py +120 -0
  82. hindsight_client_api/models/update_disposition_request.py +1 -1
  83. hindsight_client_api/models/update_mental_model_request.py +125 -0
  84. hindsight_client_api/models/validation_error.py +1 -1
  85. hindsight_client_api/models/validation_error_loc_inner.py +1 -1
  86. hindsight_client_api/models/version_response.py +93 -0
  87. hindsight_client_api/rest.py +1 -1
  88. hindsight_client-0.3.0.dist-info/RECORD +0 -65
  89. {hindsight_client-0.3.0.dist-info → hindsight_client-0.4.1.dist-info}/WHEEL +0 -0
@@ -0,0 +1,1619 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Hindsight HTTP API
5
+
6
+ HTTP API for Hindsight
7
+
8
+ The version of the OpenAPI document: 0.4.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+ import warnings
15
+ from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
16
+ from typing import Any, Dict, List, Optional, Tuple, Union
17
+ from typing_extensions import Annotated
18
+
19
+ from pydantic import Field, StrictBool, StrictStr, field_validator
20
+ from typing import Any, List, Optional
21
+ from typing_extensions import Annotated
22
+ from hindsight_client_api.models.create_directive_request import CreateDirectiveRequest
23
+ from hindsight_client_api.models.directive_list_response import DirectiveListResponse
24
+ from hindsight_client_api.models.directive_response import DirectiveResponse
25
+ from hindsight_client_api.models.update_directive_request import UpdateDirectiveRequest
26
+
27
+ from hindsight_client_api.api_client import ApiClient, RequestSerialized
28
+ from hindsight_client_api.api_response import ApiResponse
29
+ from hindsight_client_api.rest import RESTResponseType
30
+
31
+
32
+ class DirectivesApi:
33
+ """NOTE: This class is auto generated by OpenAPI Generator
34
+ Ref: https://openapi-generator.tech
35
+
36
+ Do not edit the class manually.
37
+ """
38
+
39
+ def __init__(self, api_client=None) -> None:
40
+ if api_client is None:
41
+ api_client = ApiClient.get_default()
42
+ self.api_client = api_client
43
+
44
+
45
+ @validate_call
46
+ async def create_directive(
47
+ self,
48
+ bank_id: StrictStr,
49
+ create_directive_request: CreateDirectiveRequest,
50
+ authorization: Optional[StrictStr] = None,
51
+ _request_timeout: Union[
52
+ None,
53
+ Annotated[StrictFloat, Field(gt=0)],
54
+ Tuple[
55
+ Annotated[StrictFloat, Field(gt=0)],
56
+ Annotated[StrictFloat, Field(gt=0)]
57
+ ]
58
+ ] = None,
59
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
60
+ _content_type: Optional[StrictStr] = None,
61
+ _headers: Optional[Dict[StrictStr, Any]] = None,
62
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
63
+ ) -> DirectiveResponse:
64
+ """Create directive
65
+
66
+ Create a hard rule that will be injected into prompts.
67
+
68
+ :param bank_id: (required)
69
+ :type bank_id: str
70
+ :param create_directive_request: (required)
71
+ :type create_directive_request: CreateDirectiveRequest
72
+ :param authorization:
73
+ :type authorization: str
74
+ :param _request_timeout: timeout setting for this request. If one
75
+ number provided, it will be total request
76
+ timeout. It can also be a pair (tuple) of
77
+ (connection, read) timeouts.
78
+ :type _request_timeout: int, tuple(int, int), optional
79
+ :param _request_auth: set to override the auth_settings for an a single
80
+ request; this effectively ignores the
81
+ authentication in the spec for a single request.
82
+ :type _request_auth: dict, optional
83
+ :param _content_type: force content-type for the request.
84
+ :type _content_type: str, Optional
85
+ :param _headers: set to override the headers for a single
86
+ request; this effectively ignores the headers
87
+ in the spec for a single request.
88
+ :type _headers: dict, optional
89
+ :param _host_index: set to override the host_index for a single
90
+ request; this effectively ignores the host_index
91
+ in the spec for a single request.
92
+ :type _host_index: int, optional
93
+ :return: Returns the result object.
94
+ """ # noqa: E501
95
+
96
+ _param = self._create_directive_serialize(
97
+ bank_id=bank_id,
98
+ create_directive_request=create_directive_request,
99
+ authorization=authorization,
100
+ _request_auth=_request_auth,
101
+ _content_type=_content_type,
102
+ _headers=_headers,
103
+ _host_index=_host_index
104
+ )
105
+
106
+ _response_types_map: Dict[str, Optional[str]] = {
107
+ '200': "DirectiveResponse",
108
+ '422': "HTTPValidationError",
109
+ }
110
+ response_data = await self.api_client.call_api(
111
+ *_param,
112
+ _request_timeout=_request_timeout
113
+ )
114
+ await response_data.read()
115
+ return self.api_client.response_deserialize(
116
+ response_data=response_data,
117
+ response_types_map=_response_types_map,
118
+ ).data
119
+
120
+
121
+ @validate_call
122
+ async def create_directive_with_http_info(
123
+ self,
124
+ bank_id: StrictStr,
125
+ create_directive_request: CreateDirectiveRequest,
126
+ authorization: Optional[StrictStr] = None,
127
+ _request_timeout: Union[
128
+ None,
129
+ Annotated[StrictFloat, Field(gt=0)],
130
+ Tuple[
131
+ Annotated[StrictFloat, Field(gt=0)],
132
+ Annotated[StrictFloat, Field(gt=0)]
133
+ ]
134
+ ] = None,
135
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
136
+ _content_type: Optional[StrictStr] = None,
137
+ _headers: Optional[Dict[StrictStr, Any]] = None,
138
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
139
+ ) -> ApiResponse[DirectiveResponse]:
140
+ """Create directive
141
+
142
+ Create a hard rule that will be injected into prompts.
143
+
144
+ :param bank_id: (required)
145
+ :type bank_id: str
146
+ :param create_directive_request: (required)
147
+ :type create_directive_request: CreateDirectiveRequest
148
+ :param authorization:
149
+ :type authorization: str
150
+ :param _request_timeout: timeout setting for this request. If one
151
+ number provided, it will be total request
152
+ timeout. It can also be a pair (tuple) of
153
+ (connection, read) timeouts.
154
+ :type _request_timeout: int, tuple(int, int), optional
155
+ :param _request_auth: set to override the auth_settings for an a single
156
+ request; this effectively ignores the
157
+ authentication in the spec for a single request.
158
+ :type _request_auth: dict, optional
159
+ :param _content_type: force content-type for the request.
160
+ :type _content_type: str, Optional
161
+ :param _headers: set to override the headers for a single
162
+ request; this effectively ignores the headers
163
+ in the spec for a single request.
164
+ :type _headers: dict, optional
165
+ :param _host_index: set to override the host_index for a single
166
+ request; this effectively ignores the host_index
167
+ in the spec for a single request.
168
+ :type _host_index: int, optional
169
+ :return: Returns the result object.
170
+ """ # noqa: E501
171
+
172
+ _param = self._create_directive_serialize(
173
+ bank_id=bank_id,
174
+ create_directive_request=create_directive_request,
175
+ authorization=authorization,
176
+ _request_auth=_request_auth,
177
+ _content_type=_content_type,
178
+ _headers=_headers,
179
+ _host_index=_host_index
180
+ )
181
+
182
+ _response_types_map: Dict[str, Optional[str]] = {
183
+ '200': "DirectiveResponse",
184
+ '422': "HTTPValidationError",
185
+ }
186
+ response_data = await self.api_client.call_api(
187
+ *_param,
188
+ _request_timeout=_request_timeout
189
+ )
190
+ await response_data.read()
191
+ return self.api_client.response_deserialize(
192
+ response_data=response_data,
193
+ response_types_map=_response_types_map,
194
+ )
195
+
196
+
197
+ @validate_call
198
+ async def create_directive_without_preload_content(
199
+ self,
200
+ bank_id: StrictStr,
201
+ create_directive_request: CreateDirectiveRequest,
202
+ authorization: Optional[StrictStr] = None,
203
+ _request_timeout: Union[
204
+ None,
205
+ Annotated[StrictFloat, Field(gt=0)],
206
+ Tuple[
207
+ Annotated[StrictFloat, Field(gt=0)],
208
+ Annotated[StrictFloat, Field(gt=0)]
209
+ ]
210
+ ] = None,
211
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
212
+ _content_type: Optional[StrictStr] = None,
213
+ _headers: Optional[Dict[StrictStr, Any]] = None,
214
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
215
+ ) -> RESTResponseType:
216
+ """Create directive
217
+
218
+ Create a hard rule that will be injected into prompts.
219
+
220
+ :param bank_id: (required)
221
+ :type bank_id: str
222
+ :param create_directive_request: (required)
223
+ :type create_directive_request: CreateDirectiveRequest
224
+ :param authorization:
225
+ :type authorization: str
226
+ :param _request_timeout: timeout setting for this request. If one
227
+ number provided, it will be total request
228
+ timeout. It can also be a pair (tuple) of
229
+ (connection, read) timeouts.
230
+ :type _request_timeout: int, tuple(int, int), optional
231
+ :param _request_auth: set to override the auth_settings for an a single
232
+ request; this effectively ignores the
233
+ authentication in the spec for a single request.
234
+ :type _request_auth: dict, optional
235
+ :param _content_type: force content-type for the request.
236
+ :type _content_type: str, Optional
237
+ :param _headers: set to override the headers for a single
238
+ request; this effectively ignores the headers
239
+ in the spec for a single request.
240
+ :type _headers: dict, optional
241
+ :param _host_index: set to override the host_index for a single
242
+ request; this effectively ignores the host_index
243
+ in the spec for a single request.
244
+ :type _host_index: int, optional
245
+ :return: Returns the result object.
246
+ """ # noqa: E501
247
+
248
+ _param = self._create_directive_serialize(
249
+ bank_id=bank_id,
250
+ create_directive_request=create_directive_request,
251
+ authorization=authorization,
252
+ _request_auth=_request_auth,
253
+ _content_type=_content_type,
254
+ _headers=_headers,
255
+ _host_index=_host_index
256
+ )
257
+
258
+ _response_types_map: Dict[str, Optional[str]] = {
259
+ '200': "DirectiveResponse",
260
+ '422': "HTTPValidationError",
261
+ }
262
+ response_data = await self.api_client.call_api(
263
+ *_param,
264
+ _request_timeout=_request_timeout
265
+ )
266
+ return response_data.response
267
+
268
+
269
+ def _create_directive_serialize(
270
+ self,
271
+ bank_id,
272
+ create_directive_request,
273
+ authorization,
274
+ _request_auth,
275
+ _content_type,
276
+ _headers,
277
+ _host_index,
278
+ ) -> RequestSerialized:
279
+
280
+ _host = None
281
+
282
+ _collection_formats: Dict[str, str] = {
283
+ }
284
+
285
+ _path_params: Dict[str, str] = {}
286
+ _query_params: List[Tuple[str, str]] = []
287
+ _header_params: Dict[str, Optional[str]] = _headers or {}
288
+ _form_params: List[Tuple[str, str]] = []
289
+ _files: Dict[
290
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
291
+ ] = {}
292
+ _body_params: Optional[bytes] = None
293
+
294
+ # process the path parameters
295
+ if bank_id is not None:
296
+ _path_params['bank_id'] = bank_id
297
+ # process the query parameters
298
+ # process the header parameters
299
+ if authorization is not None:
300
+ _header_params['authorization'] = authorization
301
+ # process the form parameters
302
+ # process the body parameter
303
+ if create_directive_request is not None:
304
+ _body_params = create_directive_request
305
+
306
+
307
+ # set the HTTP header `Accept`
308
+ if 'Accept' not in _header_params:
309
+ _header_params['Accept'] = self.api_client.select_header_accept(
310
+ [
311
+ 'application/json'
312
+ ]
313
+ )
314
+
315
+ # set the HTTP header `Content-Type`
316
+ if _content_type:
317
+ _header_params['Content-Type'] = _content_type
318
+ else:
319
+ _default_content_type = (
320
+ self.api_client.select_header_content_type(
321
+ [
322
+ 'application/json'
323
+ ]
324
+ )
325
+ )
326
+ if _default_content_type is not None:
327
+ _header_params['Content-Type'] = _default_content_type
328
+
329
+ # authentication setting
330
+ _auth_settings: List[str] = [
331
+ ]
332
+
333
+ return self.api_client.param_serialize(
334
+ method='POST',
335
+ resource_path='/v1/default/banks/{bank_id}/directives',
336
+ path_params=_path_params,
337
+ query_params=_query_params,
338
+ header_params=_header_params,
339
+ body=_body_params,
340
+ post_params=_form_params,
341
+ files=_files,
342
+ auth_settings=_auth_settings,
343
+ collection_formats=_collection_formats,
344
+ _host=_host,
345
+ _request_auth=_request_auth
346
+ )
347
+
348
+
349
+
350
+
351
+ @validate_call
352
+ async def delete_directive(
353
+ self,
354
+ bank_id: StrictStr,
355
+ directive_id: StrictStr,
356
+ authorization: Optional[StrictStr] = None,
357
+ _request_timeout: Union[
358
+ None,
359
+ Annotated[StrictFloat, Field(gt=0)],
360
+ Tuple[
361
+ Annotated[StrictFloat, Field(gt=0)],
362
+ Annotated[StrictFloat, Field(gt=0)]
363
+ ]
364
+ ] = None,
365
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
366
+ _content_type: Optional[StrictStr] = None,
367
+ _headers: Optional[Dict[StrictStr, Any]] = None,
368
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
369
+ ) -> object:
370
+ """Delete directive
371
+
372
+ Delete a directive.
373
+
374
+ :param bank_id: (required)
375
+ :type bank_id: str
376
+ :param directive_id: (required)
377
+ :type directive_id: str
378
+ :param authorization:
379
+ :type authorization: str
380
+ :param _request_timeout: timeout setting for this request. If one
381
+ number provided, it will be total request
382
+ timeout. It can also be a pair (tuple) of
383
+ (connection, read) timeouts.
384
+ :type _request_timeout: int, tuple(int, int), optional
385
+ :param _request_auth: set to override the auth_settings for an a single
386
+ request; this effectively ignores the
387
+ authentication in the spec for a single request.
388
+ :type _request_auth: dict, optional
389
+ :param _content_type: force content-type for the request.
390
+ :type _content_type: str, Optional
391
+ :param _headers: set to override the headers for a single
392
+ request; this effectively ignores the headers
393
+ in the spec for a single request.
394
+ :type _headers: dict, optional
395
+ :param _host_index: set to override the host_index for a single
396
+ request; this effectively ignores the host_index
397
+ in the spec for a single request.
398
+ :type _host_index: int, optional
399
+ :return: Returns the result object.
400
+ """ # noqa: E501
401
+
402
+ _param = self._delete_directive_serialize(
403
+ bank_id=bank_id,
404
+ directive_id=directive_id,
405
+ authorization=authorization,
406
+ _request_auth=_request_auth,
407
+ _content_type=_content_type,
408
+ _headers=_headers,
409
+ _host_index=_host_index
410
+ )
411
+
412
+ _response_types_map: Dict[str, Optional[str]] = {
413
+ '200': "object",
414
+ '422': "HTTPValidationError",
415
+ }
416
+ response_data = await self.api_client.call_api(
417
+ *_param,
418
+ _request_timeout=_request_timeout
419
+ )
420
+ await response_data.read()
421
+ return self.api_client.response_deserialize(
422
+ response_data=response_data,
423
+ response_types_map=_response_types_map,
424
+ ).data
425
+
426
+
427
+ @validate_call
428
+ async def delete_directive_with_http_info(
429
+ self,
430
+ bank_id: StrictStr,
431
+ directive_id: StrictStr,
432
+ authorization: Optional[StrictStr] = None,
433
+ _request_timeout: Union[
434
+ None,
435
+ Annotated[StrictFloat, Field(gt=0)],
436
+ Tuple[
437
+ Annotated[StrictFloat, Field(gt=0)],
438
+ Annotated[StrictFloat, Field(gt=0)]
439
+ ]
440
+ ] = None,
441
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
442
+ _content_type: Optional[StrictStr] = None,
443
+ _headers: Optional[Dict[StrictStr, Any]] = None,
444
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
445
+ ) -> ApiResponse[object]:
446
+ """Delete directive
447
+
448
+ Delete a directive.
449
+
450
+ :param bank_id: (required)
451
+ :type bank_id: str
452
+ :param directive_id: (required)
453
+ :type directive_id: str
454
+ :param authorization:
455
+ :type authorization: str
456
+ :param _request_timeout: timeout setting for this request. If one
457
+ number provided, it will be total request
458
+ timeout. It can also be a pair (tuple) of
459
+ (connection, read) timeouts.
460
+ :type _request_timeout: int, tuple(int, int), optional
461
+ :param _request_auth: set to override the auth_settings for an a single
462
+ request; this effectively ignores the
463
+ authentication in the spec for a single request.
464
+ :type _request_auth: dict, optional
465
+ :param _content_type: force content-type for the request.
466
+ :type _content_type: str, Optional
467
+ :param _headers: set to override the headers for a single
468
+ request; this effectively ignores the headers
469
+ in the spec for a single request.
470
+ :type _headers: dict, optional
471
+ :param _host_index: set to override the host_index for a single
472
+ request; this effectively ignores the host_index
473
+ in the spec for a single request.
474
+ :type _host_index: int, optional
475
+ :return: Returns the result object.
476
+ """ # noqa: E501
477
+
478
+ _param = self._delete_directive_serialize(
479
+ bank_id=bank_id,
480
+ directive_id=directive_id,
481
+ authorization=authorization,
482
+ _request_auth=_request_auth,
483
+ _content_type=_content_type,
484
+ _headers=_headers,
485
+ _host_index=_host_index
486
+ )
487
+
488
+ _response_types_map: Dict[str, Optional[str]] = {
489
+ '200': "object",
490
+ '422': "HTTPValidationError",
491
+ }
492
+ response_data = await self.api_client.call_api(
493
+ *_param,
494
+ _request_timeout=_request_timeout
495
+ )
496
+ await response_data.read()
497
+ return self.api_client.response_deserialize(
498
+ response_data=response_data,
499
+ response_types_map=_response_types_map,
500
+ )
501
+
502
+
503
+ @validate_call
504
+ async def delete_directive_without_preload_content(
505
+ self,
506
+ bank_id: StrictStr,
507
+ directive_id: StrictStr,
508
+ authorization: Optional[StrictStr] = None,
509
+ _request_timeout: Union[
510
+ None,
511
+ Annotated[StrictFloat, Field(gt=0)],
512
+ Tuple[
513
+ Annotated[StrictFloat, Field(gt=0)],
514
+ Annotated[StrictFloat, Field(gt=0)]
515
+ ]
516
+ ] = None,
517
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
518
+ _content_type: Optional[StrictStr] = None,
519
+ _headers: Optional[Dict[StrictStr, Any]] = None,
520
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
521
+ ) -> RESTResponseType:
522
+ """Delete directive
523
+
524
+ Delete a directive.
525
+
526
+ :param bank_id: (required)
527
+ :type bank_id: str
528
+ :param directive_id: (required)
529
+ :type directive_id: str
530
+ :param authorization:
531
+ :type authorization: str
532
+ :param _request_timeout: timeout setting for this request. If one
533
+ number provided, it will be total request
534
+ timeout. It can also be a pair (tuple) of
535
+ (connection, read) timeouts.
536
+ :type _request_timeout: int, tuple(int, int), optional
537
+ :param _request_auth: set to override the auth_settings for an a single
538
+ request; this effectively ignores the
539
+ authentication in the spec for a single request.
540
+ :type _request_auth: dict, optional
541
+ :param _content_type: force content-type for the request.
542
+ :type _content_type: str, Optional
543
+ :param _headers: set to override the headers for a single
544
+ request; this effectively ignores the headers
545
+ in the spec for a single request.
546
+ :type _headers: dict, optional
547
+ :param _host_index: set to override the host_index for a single
548
+ request; this effectively ignores the host_index
549
+ in the spec for a single request.
550
+ :type _host_index: int, optional
551
+ :return: Returns the result object.
552
+ """ # noqa: E501
553
+
554
+ _param = self._delete_directive_serialize(
555
+ bank_id=bank_id,
556
+ directive_id=directive_id,
557
+ authorization=authorization,
558
+ _request_auth=_request_auth,
559
+ _content_type=_content_type,
560
+ _headers=_headers,
561
+ _host_index=_host_index
562
+ )
563
+
564
+ _response_types_map: Dict[str, Optional[str]] = {
565
+ '200': "object",
566
+ '422': "HTTPValidationError",
567
+ }
568
+ response_data = await self.api_client.call_api(
569
+ *_param,
570
+ _request_timeout=_request_timeout
571
+ )
572
+ return response_data.response
573
+
574
+
575
+ def _delete_directive_serialize(
576
+ self,
577
+ bank_id,
578
+ directive_id,
579
+ authorization,
580
+ _request_auth,
581
+ _content_type,
582
+ _headers,
583
+ _host_index,
584
+ ) -> RequestSerialized:
585
+
586
+ _host = None
587
+
588
+ _collection_formats: Dict[str, str] = {
589
+ }
590
+
591
+ _path_params: Dict[str, str] = {}
592
+ _query_params: List[Tuple[str, str]] = []
593
+ _header_params: Dict[str, Optional[str]] = _headers or {}
594
+ _form_params: List[Tuple[str, str]] = []
595
+ _files: Dict[
596
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
597
+ ] = {}
598
+ _body_params: Optional[bytes] = None
599
+
600
+ # process the path parameters
601
+ if bank_id is not None:
602
+ _path_params['bank_id'] = bank_id
603
+ if directive_id is not None:
604
+ _path_params['directive_id'] = directive_id
605
+ # process the query parameters
606
+ # process the header parameters
607
+ if authorization is not None:
608
+ _header_params['authorization'] = authorization
609
+ # process the form parameters
610
+ # process the body parameter
611
+
612
+
613
+ # set the HTTP header `Accept`
614
+ if 'Accept' not in _header_params:
615
+ _header_params['Accept'] = self.api_client.select_header_accept(
616
+ [
617
+ 'application/json'
618
+ ]
619
+ )
620
+
621
+
622
+ # authentication setting
623
+ _auth_settings: List[str] = [
624
+ ]
625
+
626
+ return self.api_client.param_serialize(
627
+ method='DELETE',
628
+ resource_path='/v1/default/banks/{bank_id}/directives/{directive_id}',
629
+ path_params=_path_params,
630
+ query_params=_query_params,
631
+ header_params=_header_params,
632
+ body=_body_params,
633
+ post_params=_form_params,
634
+ files=_files,
635
+ auth_settings=_auth_settings,
636
+ collection_formats=_collection_formats,
637
+ _host=_host,
638
+ _request_auth=_request_auth
639
+ )
640
+
641
+
642
+
643
+
644
+ @validate_call
645
+ async def get_directive(
646
+ self,
647
+ bank_id: StrictStr,
648
+ directive_id: StrictStr,
649
+ authorization: Optional[StrictStr] = None,
650
+ _request_timeout: Union[
651
+ None,
652
+ Annotated[StrictFloat, Field(gt=0)],
653
+ Tuple[
654
+ Annotated[StrictFloat, Field(gt=0)],
655
+ Annotated[StrictFloat, Field(gt=0)]
656
+ ]
657
+ ] = None,
658
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
659
+ _content_type: Optional[StrictStr] = None,
660
+ _headers: Optional[Dict[StrictStr, Any]] = None,
661
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
662
+ ) -> DirectiveResponse:
663
+ """Get directive
664
+
665
+ Get a specific directive by ID.
666
+
667
+ :param bank_id: (required)
668
+ :type bank_id: str
669
+ :param directive_id: (required)
670
+ :type directive_id: str
671
+ :param authorization:
672
+ :type authorization: str
673
+ :param _request_timeout: timeout setting for this request. If one
674
+ number provided, it will be total request
675
+ timeout. It can also be a pair (tuple) of
676
+ (connection, read) timeouts.
677
+ :type _request_timeout: int, tuple(int, int), optional
678
+ :param _request_auth: set to override the auth_settings for an a single
679
+ request; this effectively ignores the
680
+ authentication in the spec for a single request.
681
+ :type _request_auth: dict, optional
682
+ :param _content_type: force content-type for the request.
683
+ :type _content_type: str, Optional
684
+ :param _headers: set to override the headers for a single
685
+ request; this effectively ignores the headers
686
+ in the spec for a single request.
687
+ :type _headers: dict, optional
688
+ :param _host_index: set to override the host_index for a single
689
+ request; this effectively ignores the host_index
690
+ in the spec for a single request.
691
+ :type _host_index: int, optional
692
+ :return: Returns the result object.
693
+ """ # noqa: E501
694
+
695
+ _param = self._get_directive_serialize(
696
+ bank_id=bank_id,
697
+ directive_id=directive_id,
698
+ authorization=authorization,
699
+ _request_auth=_request_auth,
700
+ _content_type=_content_type,
701
+ _headers=_headers,
702
+ _host_index=_host_index
703
+ )
704
+
705
+ _response_types_map: Dict[str, Optional[str]] = {
706
+ '200': "DirectiveResponse",
707
+ '422': "HTTPValidationError",
708
+ }
709
+ response_data = await self.api_client.call_api(
710
+ *_param,
711
+ _request_timeout=_request_timeout
712
+ )
713
+ await response_data.read()
714
+ return self.api_client.response_deserialize(
715
+ response_data=response_data,
716
+ response_types_map=_response_types_map,
717
+ ).data
718
+
719
+
720
+ @validate_call
721
+ async def get_directive_with_http_info(
722
+ self,
723
+ bank_id: StrictStr,
724
+ directive_id: StrictStr,
725
+ authorization: Optional[StrictStr] = None,
726
+ _request_timeout: Union[
727
+ None,
728
+ Annotated[StrictFloat, Field(gt=0)],
729
+ Tuple[
730
+ Annotated[StrictFloat, Field(gt=0)],
731
+ Annotated[StrictFloat, Field(gt=0)]
732
+ ]
733
+ ] = None,
734
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
735
+ _content_type: Optional[StrictStr] = None,
736
+ _headers: Optional[Dict[StrictStr, Any]] = None,
737
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
738
+ ) -> ApiResponse[DirectiveResponse]:
739
+ """Get directive
740
+
741
+ Get a specific directive by ID.
742
+
743
+ :param bank_id: (required)
744
+ :type bank_id: str
745
+ :param directive_id: (required)
746
+ :type directive_id: str
747
+ :param authorization:
748
+ :type authorization: str
749
+ :param _request_timeout: timeout setting for this request. If one
750
+ number provided, it will be total request
751
+ timeout. It can also be a pair (tuple) of
752
+ (connection, read) timeouts.
753
+ :type _request_timeout: int, tuple(int, int), optional
754
+ :param _request_auth: set to override the auth_settings for an a single
755
+ request; this effectively ignores the
756
+ authentication in the spec for a single request.
757
+ :type _request_auth: dict, optional
758
+ :param _content_type: force content-type for the request.
759
+ :type _content_type: str, Optional
760
+ :param _headers: set to override the headers for a single
761
+ request; this effectively ignores the headers
762
+ in the spec for a single request.
763
+ :type _headers: dict, optional
764
+ :param _host_index: set to override the host_index for a single
765
+ request; this effectively ignores the host_index
766
+ in the spec for a single request.
767
+ :type _host_index: int, optional
768
+ :return: Returns the result object.
769
+ """ # noqa: E501
770
+
771
+ _param = self._get_directive_serialize(
772
+ bank_id=bank_id,
773
+ directive_id=directive_id,
774
+ authorization=authorization,
775
+ _request_auth=_request_auth,
776
+ _content_type=_content_type,
777
+ _headers=_headers,
778
+ _host_index=_host_index
779
+ )
780
+
781
+ _response_types_map: Dict[str, Optional[str]] = {
782
+ '200': "DirectiveResponse",
783
+ '422': "HTTPValidationError",
784
+ }
785
+ response_data = await self.api_client.call_api(
786
+ *_param,
787
+ _request_timeout=_request_timeout
788
+ )
789
+ await response_data.read()
790
+ return self.api_client.response_deserialize(
791
+ response_data=response_data,
792
+ response_types_map=_response_types_map,
793
+ )
794
+
795
+
796
+ @validate_call
797
+ async def get_directive_without_preload_content(
798
+ self,
799
+ bank_id: StrictStr,
800
+ directive_id: StrictStr,
801
+ authorization: Optional[StrictStr] = None,
802
+ _request_timeout: Union[
803
+ None,
804
+ Annotated[StrictFloat, Field(gt=0)],
805
+ Tuple[
806
+ Annotated[StrictFloat, Field(gt=0)],
807
+ Annotated[StrictFloat, Field(gt=0)]
808
+ ]
809
+ ] = None,
810
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
811
+ _content_type: Optional[StrictStr] = None,
812
+ _headers: Optional[Dict[StrictStr, Any]] = None,
813
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
814
+ ) -> RESTResponseType:
815
+ """Get directive
816
+
817
+ Get a specific directive by ID.
818
+
819
+ :param bank_id: (required)
820
+ :type bank_id: str
821
+ :param directive_id: (required)
822
+ :type directive_id: str
823
+ :param authorization:
824
+ :type authorization: str
825
+ :param _request_timeout: timeout setting for this request. If one
826
+ number provided, it will be total request
827
+ timeout. It can also be a pair (tuple) of
828
+ (connection, read) timeouts.
829
+ :type _request_timeout: int, tuple(int, int), optional
830
+ :param _request_auth: set to override the auth_settings for an a single
831
+ request; this effectively ignores the
832
+ authentication in the spec for a single request.
833
+ :type _request_auth: dict, optional
834
+ :param _content_type: force content-type for the request.
835
+ :type _content_type: str, Optional
836
+ :param _headers: set to override the headers for a single
837
+ request; this effectively ignores the headers
838
+ in the spec for a single request.
839
+ :type _headers: dict, optional
840
+ :param _host_index: set to override the host_index for a single
841
+ request; this effectively ignores the host_index
842
+ in the spec for a single request.
843
+ :type _host_index: int, optional
844
+ :return: Returns the result object.
845
+ """ # noqa: E501
846
+
847
+ _param = self._get_directive_serialize(
848
+ bank_id=bank_id,
849
+ directive_id=directive_id,
850
+ authorization=authorization,
851
+ _request_auth=_request_auth,
852
+ _content_type=_content_type,
853
+ _headers=_headers,
854
+ _host_index=_host_index
855
+ )
856
+
857
+ _response_types_map: Dict[str, Optional[str]] = {
858
+ '200': "DirectiveResponse",
859
+ '422': "HTTPValidationError",
860
+ }
861
+ response_data = await self.api_client.call_api(
862
+ *_param,
863
+ _request_timeout=_request_timeout
864
+ )
865
+ return response_data.response
866
+
867
+
868
+ def _get_directive_serialize(
869
+ self,
870
+ bank_id,
871
+ directive_id,
872
+ authorization,
873
+ _request_auth,
874
+ _content_type,
875
+ _headers,
876
+ _host_index,
877
+ ) -> RequestSerialized:
878
+
879
+ _host = None
880
+
881
+ _collection_formats: Dict[str, str] = {
882
+ }
883
+
884
+ _path_params: Dict[str, str] = {}
885
+ _query_params: List[Tuple[str, str]] = []
886
+ _header_params: Dict[str, Optional[str]] = _headers or {}
887
+ _form_params: List[Tuple[str, str]] = []
888
+ _files: Dict[
889
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
890
+ ] = {}
891
+ _body_params: Optional[bytes] = None
892
+
893
+ # process the path parameters
894
+ if bank_id is not None:
895
+ _path_params['bank_id'] = bank_id
896
+ if directive_id is not None:
897
+ _path_params['directive_id'] = directive_id
898
+ # process the query parameters
899
+ # process the header parameters
900
+ if authorization is not None:
901
+ _header_params['authorization'] = authorization
902
+ # process the form parameters
903
+ # process the body parameter
904
+
905
+
906
+ # set the HTTP header `Accept`
907
+ if 'Accept' not in _header_params:
908
+ _header_params['Accept'] = self.api_client.select_header_accept(
909
+ [
910
+ 'application/json'
911
+ ]
912
+ )
913
+
914
+
915
+ # authentication setting
916
+ _auth_settings: List[str] = [
917
+ ]
918
+
919
+ return self.api_client.param_serialize(
920
+ method='GET',
921
+ resource_path='/v1/default/banks/{bank_id}/directives/{directive_id}',
922
+ path_params=_path_params,
923
+ query_params=_query_params,
924
+ header_params=_header_params,
925
+ body=_body_params,
926
+ post_params=_form_params,
927
+ files=_files,
928
+ auth_settings=_auth_settings,
929
+ collection_formats=_collection_formats,
930
+ _host=_host,
931
+ _request_auth=_request_auth
932
+ )
933
+
934
+
935
+
936
+
937
+ @validate_call
938
+ async def list_directives(
939
+ self,
940
+ bank_id: StrictStr,
941
+ tags: Annotated[Optional[List[StrictStr]], Field(description="Filter by tags")] = None,
942
+ tags_match: Annotated[Optional[StrictStr], Field(description="How to match tags")] = None,
943
+ active_only: Annotated[Optional[StrictBool], Field(description="Only return active directives")] = None,
944
+ limit: Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]] = None,
945
+ offset: Optional[Annotated[int, Field(strict=True, ge=0)]] = None,
946
+ authorization: Optional[StrictStr] = None,
947
+ _request_timeout: Union[
948
+ None,
949
+ Annotated[StrictFloat, Field(gt=0)],
950
+ Tuple[
951
+ Annotated[StrictFloat, Field(gt=0)],
952
+ Annotated[StrictFloat, Field(gt=0)]
953
+ ]
954
+ ] = None,
955
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
956
+ _content_type: Optional[StrictStr] = None,
957
+ _headers: Optional[Dict[StrictStr, Any]] = None,
958
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
959
+ ) -> DirectiveListResponse:
960
+ """List directives
961
+
962
+ List hard rules that are injected into prompts.
963
+
964
+ :param bank_id: (required)
965
+ :type bank_id: str
966
+ :param tags: Filter by tags
967
+ :type tags: List[str]
968
+ :param tags_match: How to match tags
969
+ :type tags_match: str
970
+ :param active_only: Only return active directives
971
+ :type active_only: bool
972
+ :param limit:
973
+ :type limit: int
974
+ :param offset:
975
+ :type offset: int
976
+ :param authorization:
977
+ :type authorization: str
978
+ :param _request_timeout: timeout setting for this request. If one
979
+ number provided, it will be total request
980
+ timeout. It can also be a pair (tuple) of
981
+ (connection, read) timeouts.
982
+ :type _request_timeout: int, tuple(int, int), optional
983
+ :param _request_auth: set to override the auth_settings for an a single
984
+ request; this effectively ignores the
985
+ authentication in the spec for a single request.
986
+ :type _request_auth: dict, optional
987
+ :param _content_type: force content-type for the request.
988
+ :type _content_type: str, Optional
989
+ :param _headers: set to override the headers for a single
990
+ request; this effectively ignores the headers
991
+ in the spec for a single request.
992
+ :type _headers: dict, optional
993
+ :param _host_index: set to override the host_index for a single
994
+ request; this effectively ignores the host_index
995
+ in the spec for a single request.
996
+ :type _host_index: int, optional
997
+ :return: Returns the result object.
998
+ """ # noqa: E501
999
+
1000
+ _param = self._list_directives_serialize(
1001
+ bank_id=bank_id,
1002
+ tags=tags,
1003
+ tags_match=tags_match,
1004
+ active_only=active_only,
1005
+ limit=limit,
1006
+ offset=offset,
1007
+ authorization=authorization,
1008
+ _request_auth=_request_auth,
1009
+ _content_type=_content_type,
1010
+ _headers=_headers,
1011
+ _host_index=_host_index
1012
+ )
1013
+
1014
+ _response_types_map: Dict[str, Optional[str]] = {
1015
+ '200': "DirectiveListResponse",
1016
+ '422': "HTTPValidationError",
1017
+ }
1018
+ response_data = await self.api_client.call_api(
1019
+ *_param,
1020
+ _request_timeout=_request_timeout
1021
+ )
1022
+ await response_data.read()
1023
+ return self.api_client.response_deserialize(
1024
+ response_data=response_data,
1025
+ response_types_map=_response_types_map,
1026
+ ).data
1027
+
1028
+
1029
+ @validate_call
1030
+ async def list_directives_with_http_info(
1031
+ self,
1032
+ bank_id: StrictStr,
1033
+ tags: Annotated[Optional[List[StrictStr]], Field(description="Filter by tags")] = None,
1034
+ tags_match: Annotated[Optional[StrictStr], Field(description="How to match tags")] = None,
1035
+ active_only: Annotated[Optional[StrictBool], Field(description="Only return active directives")] = None,
1036
+ limit: Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]] = None,
1037
+ offset: Optional[Annotated[int, Field(strict=True, ge=0)]] = None,
1038
+ authorization: Optional[StrictStr] = None,
1039
+ _request_timeout: Union[
1040
+ None,
1041
+ Annotated[StrictFloat, Field(gt=0)],
1042
+ Tuple[
1043
+ Annotated[StrictFloat, Field(gt=0)],
1044
+ Annotated[StrictFloat, Field(gt=0)]
1045
+ ]
1046
+ ] = None,
1047
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1048
+ _content_type: Optional[StrictStr] = None,
1049
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1050
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1051
+ ) -> ApiResponse[DirectiveListResponse]:
1052
+ """List directives
1053
+
1054
+ List hard rules that are injected into prompts.
1055
+
1056
+ :param bank_id: (required)
1057
+ :type bank_id: str
1058
+ :param tags: Filter by tags
1059
+ :type tags: List[str]
1060
+ :param tags_match: How to match tags
1061
+ :type tags_match: str
1062
+ :param active_only: Only return active directives
1063
+ :type active_only: bool
1064
+ :param limit:
1065
+ :type limit: int
1066
+ :param offset:
1067
+ :type offset: int
1068
+ :param authorization:
1069
+ :type authorization: str
1070
+ :param _request_timeout: timeout setting for this request. If one
1071
+ number provided, it will be total request
1072
+ timeout. It can also be a pair (tuple) of
1073
+ (connection, read) timeouts.
1074
+ :type _request_timeout: int, tuple(int, int), optional
1075
+ :param _request_auth: set to override the auth_settings for an a single
1076
+ request; this effectively ignores the
1077
+ authentication in the spec for a single request.
1078
+ :type _request_auth: dict, optional
1079
+ :param _content_type: force content-type for the request.
1080
+ :type _content_type: str, Optional
1081
+ :param _headers: set to override the headers for a single
1082
+ request; this effectively ignores the headers
1083
+ in the spec for a single request.
1084
+ :type _headers: dict, optional
1085
+ :param _host_index: set to override the host_index for a single
1086
+ request; this effectively ignores the host_index
1087
+ in the spec for a single request.
1088
+ :type _host_index: int, optional
1089
+ :return: Returns the result object.
1090
+ """ # noqa: E501
1091
+
1092
+ _param = self._list_directives_serialize(
1093
+ bank_id=bank_id,
1094
+ tags=tags,
1095
+ tags_match=tags_match,
1096
+ active_only=active_only,
1097
+ limit=limit,
1098
+ offset=offset,
1099
+ authorization=authorization,
1100
+ _request_auth=_request_auth,
1101
+ _content_type=_content_type,
1102
+ _headers=_headers,
1103
+ _host_index=_host_index
1104
+ )
1105
+
1106
+ _response_types_map: Dict[str, Optional[str]] = {
1107
+ '200': "DirectiveListResponse",
1108
+ '422': "HTTPValidationError",
1109
+ }
1110
+ response_data = await self.api_client.call_api(
1111
+ *_param,
1112
+ _request_timeout=_request_timeout
1113
+ )
1114
+ await response_data.read()
1115
+ return self.api_client.response_deserialize(
1116
+ response_data=response_data,
1117
+ response_types_map=_response_types_map,
1118
+ )
1119
+
1120
+
1121
+ @validate_call
1122
+ async def list_directives_without_preload_content(
1123
+ self,
1124
+ bank_id: StrictStr,
1125
+ tags: Annotated[Optional[List[StrictStr]], Field(description="Filter by tags")] = None,
1126
+ tags_match: Annotated[Optional[StrictStr], Field(description="How to match tags")] = None,
1127
+ active_only: Annotated[Optional[StrictBool], Field(description="Only return active directives")] = None,
1128
+ limit: Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]] = None,
1129
+ offset: Optional[Annotated[int, Field(strict=True, ge=0)]] = None,
1130
+ authorization: Optional[StrictStr] = None,
1131
+ _request_timeout: Union[
1132
+ None,
1133
+ Annotated[StrictFloat, Field(gt=0)],
1134
+ Tuple[
1135
+ Annotated[StrictFloat, Field(gt=0)],
1136
+ Annotated[StrictFloat, Field(gt=0)]
1137
+ ]
1138
+ ] = None,
1139
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1140
+ _content_type: Optional[StrictStr] = None,
1141
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1142
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1143
+ ) -> RESTResponseType:
1144
+ """List directives
1145
+
1146
+ List hard rules that are injected into prompts.
1147
+
1148
+ :param bank_id: (required)
1149
+ :type bank_id: str
1150
+ :param tags: Filter by tags
1151
+ :type tags: List[str]
1152
+ :param tags_match: How to match tags
1153
+ :type tags_match: str
1154
+ :param active_only: Only return active directives
1155
+ :type active_only: bool
1156
+ :param limit:
1157
+ :type limit: int
1158
+ :param offset:
1159
+ :type offset: int
1160
+ :param authorization:
1161
+ :type authorization: str
1162
+ :param _request_timeout: timeout setting for this request. If one
1163
+ number provided, it will be total request
1164
+ timeout. It can also be a pair (tuple) of
1165
+ (connection, read) timeouts.
1166
+ :type _request_timeout: int, tuple(int, int), optional
1167
+ :param _request_auth: set to override the auth_settings for an a single
1168
+ request; this effectively ignores the
1169
+ authentication in the spec for a single request.
1170
+ :type _request_auth: dict, optional
1171
+ :param _content_type: force content-type for the request.
1172
+ :type _content_type: str, Optional
1173
+ :param _headers: set to override the headers for a single
1174
+ request; this effectively ignores the headers
1175
+ in the spec for a single request.
1176
+ :type _headers: dict, optional
1177
+ :param _host_index: set to override the host_index for a single
1178
+ request; this effectively ignores the host_index
1179
+ in the spec for a single request.
1180
+ :type _host_index: int, optional
1181
+ :return: Returns the result object.
1182
+ """ # noqa: E501
1183
+
1184
+ _param = self._list_directives_serialize(
1185
+ bank_id=bank_id,
1186
+ tags=tags,
1187
+ tags_match=tags_match,
1188
+ active_only=active_only,
1189
+ limit=limit,
1190
+ offset=offset,
1191
+ authorization=authorization,
1192
+ _request_auth=_request_auth,
1193
+ _content_type=_content_type,
1194
+ _headers=_headers,
1195
+ _host_index=_host_index
1196
+ )
1197
+
1198
+ _response_types_map: Dict[str, Optional[str]] = {
1199
+ '200': "DirectiveListResponse",
1200
+ '422': "HTTPValidationError",
1201
+ }
1202
+ response_data = await self.api_client.call_api(
1203
+ *_param,
1204
+ _request_timeout=_request_timeout
1205
+ )
1206
+ return response_data.response
1207
+
1208
+
1209
+ def _list_directives_serialize(
1210
+ self,
1211
+ bank_id,
1212
+ tags,
1213
+ tags_match,
1214
+ active_only,
1215
+ limit,
1216
+ offset,
1217
+ authorization,
1218
+ _request_auth,
1219
+ _content_type,
1220
+ _headers,
1221
+ _host_index,
1222
+ ) -> RequestSerialized:
1223
+
1224
+ _host = None
1225
+
1226
+ _collection_formats: Dict[str, str] = {
1227
+ 'tags': 'multi',
1228
+ }
1229
+
1230
+ _path_params: Dict[str, str] = {}
1231
+ _query_params: List[Tuple[str, str]] = []
1232
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1233
+ _form_params: List[Tuple[str, str]] = []
1234
+ _files: Dict[
1235
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
1236
+ ] = {}
1237
+ _body_params: Optional[bytes] = None
1238
+
1239
+ # process the path parameters
1240
+ if bank_id is not None:
1241
+ _path_params['bank_id'] = bank_id
1242
+ # process the query parameters
1243
+ if tags is not None:
1244
+
1245
+ _query_params.append(('tags', tags))
1246
+
1247
+ if tags_match is not None:
1248
+
1249
+ _query_params.append(('tags_match', tags_match))
1250
+
1251
+ if active_only is not None:
1252
+
1253
+ _query_params.append(('active_only', active_only))
1254
+
1255
+ if limit is not None:
1256
+
1257
+ _query_params.append(('limit', limit))
1258
+
1259
+ if offset is not None:
1260
+
1261
+ _query_params.append(('offset', offset))
1262
+
1263
+ # process the header parameters
1264
+ if authorization is not None:
1265
+ _header_params['authorization'] = authorization
1266
+ # process the form parameters
1267
+ # process the body parameter
1268
+
1269
+
1270
+ # set the HTTP header `Accept`
1271
+ if 'Accept' not in _header_params:
1272
+ _header_params['Accept'] = self.api_client.select_header_accept(
1273
+ [
1274
+ 'application/json'
1275
+ ]
1276
+ )
1277
+
1278
+
1279
+ # authentication setting
1280
+ _auth_settings: List[str] = [
1281
+ ]
1282
+
1283
+ return self.api_client.param_serialize(
1284
+ method='GET',
1285
+ resource_path='/v1/default/banks/{bank_id}/directives',
1286
+ path_params=_path_params,
1287
+ query_params=_query_params,
1288
+ header_params=_header_params,
1289
+ body=_body_params,
1290
+ post_params=_form_params,
1291
+ files=_files,
1292
+ auth_settings=_auth_settings,
1293
+ collection_formats=_collection_formats,
1294
+ _host=_host,
1295
+ _request_auth=_request_auth
1296
+ )
1297
+
1298
+
1299
+
1300
+
1301
+ @validate_call
1302
+ async def update_directive(
1303
+ self,
1304
+ bank_id: StrictStr,
1305
+ directive_id: StrictStr,
1306
+ update_directive_request: UpdateDirectiveRequest,
1307
+ authorization: Optional[StrictStr] = None,
1308
+ _request_timeout: Union[
1309
+ None,
1310
+ Annotated[StrictFloat, Field(gt=0)],
1311
+ Tuple[
1312
+ Annotated[StrictFloat, Field(gt=0)],
1313
+ Annotated[StrictFloat, Field(gt=0)]
1314
+ ]
1315
+ ] = None,
1316
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1317
+ _content_type: Optional[StrictStr] = None,
1318
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1319
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1320
+ ) -> DirectiveResponse:
1321
+ """Update directive
1322
+
1323
+ Update a directive's properties.
1324
+
1325
+ :param bank_id: (required)
1326
+ :type bank_id: str
1327
+ :param directive_id: (required)
1328
+ :type directive_id: str
1329
+ :param update_directive_request: (required)
1330
+ :type update_directive_request: UpdateDirectiveRequest
1331
+ :param authorization:
1332
+ :type authorization: str
1333
+ :param _request_timeout: timeout setting for this request. If one
1334
+ number provided, it will be total request
1335
+ timeout. It can also be a pair (tuple) of
1336
+ (connection, read) timeouts.
1337
+ :type _request_timeout: int, tuple(int, int), optional
1338
+ :param _request_auth: set to override the auth_settings for an a single
1339
+ request; this effectively ignores the
1340
+ authentication in the spec for a single request.
1341
+ :type _request_auth: dict, optional
1342
+ :param _content_type: force content-type for the request.
1343
+ :type _content_type: str, Optional
1344
+ :param _headers: set to override the headers for a single
1345
+ request; this effectively ignores the headers
1346
+ in the spec for a single request.
1347
+ :type _headers: dict, optional
1348
+ :param _host_index: set to override the host_index for a single
1349
+ request; this effectively ignores the host_index
1350
+ in the spec for a single request.
1351
+ :type _host_index: int, optional
1352
+ :return: Returns the result object.
1353
+ """ # noqa: E501
1354
+
1355
+ _param = self._update_directive_serialize(
1356
+ bank_id=bank_id,
1357
+ directive_id=directive_id,
1358
+ update_directive_request=update_directive_request,
1359
+ authorization=authorization,
1360
+ _request_auth=_request_auth,
1361
+ _content_type=_content_type,
1362
+ _headers=_headers,
1363
+ _host_index=_host_index
1364
+ )
1365
+
1366
+ _response_types_map: Dict[str, Optional[str]] = {
1367
+ '200': "DirectiveResponse",
1368
+ '422': "HTTPValidationError",
1369
+ }
1370
+ response_data = await self.api_client.call_api(
1371
+ *_param,
1372
+ _request_timeout=_request_timeout
1373
+ )
1374
+ await response_data.read()
1375
+ return self.api_client.response_deserialize(
1376
+ response_data=response_data,
1377
+ response_types_map=_response_types_map,
1378
+ ).data
1379
+
1380
+
1381
+ @validate_call
1382
+ async def update_directive_with_http_info(
1383
+ self,
1384
+ bank_id: StrictStr,
1385
+ directive_id: StrictStr,
1386
+ update_directive_request: UpdateDirectiveRequest,
1387
+ authorization: Optional[StrictStr] = None,
1388
+ _request_timeout: Union[
1389
+ None,
1390
+ Annotated[StrictFloat, Field(gt=0)],
1391
+ Tuple[
1392
+ Annotated[StrictFloat, Field(gt=0)],
1393
+ Annotated[StrictFloat, Field(gt=0)]
1394
+ ]
1395
+ ] = None,
1396
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1397
+ _content_type: Optional[StrictStr] = None,
1398
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1399
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1400
+ ) -> ApiResponse[DirectiveResponse]:
1401
+ """Update directive
1402
+
1403
+ Update a directive's properties.
1404
+
1405
+ :param bank_id: (required)
1406
+ :type bank_id: str
1407
+ :param directive_id: (required)
1408
+ :type directive_id: str
1409
+ :param update_directive_request: (required)
1410
+ :type update_directive_request: UpdateDirectiveRequest
1411
+ :param authorization:
1412
+ :type authorization: str
1413
+ :param _request_timeout: timeout setting for this request. If one
1414
+ number provided, it will be total request
1415
+ timeout. It can also be a pair (tuple) of
1416
+ (connection, read) timeouts.
1417
+ :type _request_timeout: int, tuple(int, int), optional
1418
+ :param _request_auth: set to override the auth_settings for an a single
1419
+ request; this effectively ignores the
1420
+ authentication in the spec for a single request.
1421
+ :type _request_auth: dict, optional
1422
+ :param _content_type: force content-type for the request.
1423
+ :type _content_type: str, Optional
1424
+ :param _headers: set to override the headers for a single
1425
+ request; this effectively ignores the headers
1426
+ in the spec for a single request.
1427
+ :type _headers: dict, optional
1428
+ :param _host_index: set to override the host_index for a single
1429
+ request; this effectively ignores the host_index
1430
+ in the spec for a single request.
1431
+ :type _host_index: int, optional
1432
+ :return: Returns the result object.
1433
+ """ # noqa: E501
1434
+
1435
+ _param = self._update_directive_serialize(
1436
+ bank_id=bank_id,
1437
+ directive_id=directive_id,
1438
+ update_directive_request=update_directive_request,
1439
+ authorization=authorization,
1440
+ _request_auth=_request_auth,
1441
+ _content_type=_content_type,
1442
+ _headers=_headers,
1443
+ _host_index=_host_index
1444
+ )
1445
+
1446
+ _response_types_map: Dict[str, Optional[str]] = {
1447
+ '200': "DirectiveResponse",
1448
+ '422': "HTTPValidationError",
1449
+ }
1450
+ response_data = await self.api_client.call_api(
1451
+ *_param,
1452
+ _request_timeout=_request_timeout
1453
+ )
1454
+ await response_data.read()
1455
+ return self.api_client.response_deserialize(
1456
+ response_data=response_data,
1457
+ response_types_map=_response_types_map,
1458
+ )
1459
+
1460
+
1461
+ @validate_call
1462
+ async def update_directive_without_preload_content(
1463
+ self,
1464
+ bank_id: StrictStr,
1465
+ directive_id: StrictStr,
1466
+ update_directive_request: UpdateDirectiveRequest,
1467
+ authorization: Optional[StrictStr] = None,
1468
+ _request_timeout: Union[
1469
+ None,
1470
+ Annotated[StrictFloat, Field(gt=0)],
1471
+ Tuple[
1472
+ Annotated[StrictFloat, Field(gt=0)],
1473
+ Annotated[StrictFloat, Field(gt=0)]
1474
+ ]
1475
+ ] = None,
1476
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1477
+ _content_type: Optional[StrictStr] = None,
1478
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1479
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1480
+ ) -> RESTResponseType:
1481
+ """Update directive
1482
+
1483
+ Update a directive's properties.
1484
+
1485
+ :param bank_id: (required)
1486
+ :type bank_id: str
1487
+ :param directive_id: (required)
1488
+ :type directive_id: str
1489
+ :param update_directive_request: (required)
1490
+ :type update_directive_request: UpdateDirectiveRequest
1491
+ :param authorization:
1492
+ :type authorization: str
1493
+ :param _request_timeout: timeout setting for this request. If one
1494
+ number provided, it will be total request
1495
+ timeout. It can also be a pair (tuple) of
1496
+ (connection, read) timeouts.
1497
+ :type _request_timeout: int, tuple(int, int), optional
1498
+ :param _request_auth: set to override the auth_settings for an a single
1499
+ request; this effectively ignores the
1500
+ authentication in the spec for a single request.
1501
+ :type _request_auth: dict, optional
1502
+ :param _content_type: force content-type for the request.
1503
+ :type _content_type: str, Optional
1504
+ :param _headers: set to override the headers for a single
1505
+ request; this effectively ignores the headers
1506
+ in the spec for a single request.
1507
+ :type _headers: dict, optional
1508
+ :param _host_index: set to override the host_index for a single
1509
+ request; this effectively ignores the host_index
1510
+ in the spec for a single request.
1511
+ :type _host_index: int, optional
1512
+ :return: Returns the result object.
1513
+ """ # noqa: E501
1514
+
1515
+ _param = self._update_directive_serialize(
1516
+ bank_id=bank_id,
1517
+ directive_id=directive_id,
1518
+ update_directive_request=update_directive_request,
1519
+ authorization=authorization,
1520
+ _request_auth=_request_auth,
1521
+ _content_type=_content_type,
1522
+ _headers=_headers,
1523
+ _host_index=_host_index
1524
+ )
1525
+
1526
+ _response_types_map: Dict[str, Optional[str]] = {
1527
+ '200': "DirectiveResponse",
1528
+ '422': "HTTPValidationError",
1529
+ }
1530
+ response_data = await self.api_client.call_api(
1531
+ *_param,
1532
+ _request_timeout=_request_timeout
1533
+ )
1534
+ return response_data.response
1535
+
1536
+
1537
+ def _update_directive_serialize(
1538
+ self,
1539
+ bank_id,
1540
+ directive_id,
1541
+ update_directive_request,
1542
+ authorization,
1543
+ _request_auth,
1544
+ _content_type,
1545
+ _headers,
1546
+ _host_index,
1547
+ ) -> RequestSerialized:
1548
+
1549
+ _host = None
1550
+
1551
+ _collection_formats: Dict[str, str] = {
1552
+ }
1553
+
1554
+ _path_params: Dict[str, str] = {}
1555
+ _query_params: List[Tuple[str, str]] = []
1556
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1557
+ _form_params: List[Tuple[str, str]] = []
1558
+ _files: Dict[
1559
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
1560
+ ] = {}
1561
+ _body_params: Optional[bytes] = None
1562
+
1563
+ # process the path parameters
1564
+ if bank_id is not None:
1565
+ _path_params['bank_id'] = bank_id
1566
+ if directive_id is not None:
1567
+ _path_params['directive_id'] = directive_id
1568
+ # process the query parameters
1569
+ # process the header parameters
1570
+ if authorization is not None:
1571
+ _header_params['authorization'] = authorization
1572
+ # process the form parameters
1573
+ # process the body parameter
1574
+ if update_directive_request is not None:
1575
+ _body_params = update_directive_request
1576
+
1577
+
1578
+ # set the HTTP header `Accept`
1579
+ if 'Accept' not in _header_params:
1580
+ _header_params['Accept'] = self.api_client.select_header_accept(
1581
+ [
1582
+ 'application/json'
1583
+ ]
1584
+ )
1585
+
1586
+ # set the HTTP header `Content-Type`
1587
+ if _content_type:
1588
+ _header_params['Content-Type'] = _content_type
1589
+ else:
1590
+ _default_content_type = (
1591
+ self.api_client.select_header_content_type(
1592
+ [
1593
+ 'application/json'
1594
+ ]
1595
+ )
1596
+ )
1597
+ if _default_content_type is not None:
1598
+ _header_params['Content-Type'] = _default_content_type
1599
+
1600
+ # authentication setting
1601
+ _auth_settings: List[str] = [
1602
+ ]
1603
+
1604
+ return self.api_client.param_serialize(
1605
+ method='PATCH',
1606
+ resource_path='/v1/default/banks/{bank_id}/directives/{directive_id}',
1607
+ path_params=_path_params,
1608
+ query_params=_query_params,
1609
+ header_params=_header_params,
1610
+ body=_body_params,
1611
+ post_params=_form_params,
1612
+ files=_files,
1613
+ auth_settings=_auth_settings,
1614
+ collection_formats=_collection_formats,
1615
+ _host=_host,
1616
+ _request_auth=_request_auth
1617
+ )
1618
+
1619
+