Skip to content

Class tigrbl_client._crud.CRUDMixin

tigrbl_client._crud.CRUDMixin

Mixin class providing REST CRUD functionality for TigrblClient.

get

get(
    path: str,
    *,
    params: dict | None = None,
    out_schema: type[_Schema[T]],
) -> T
get(
    path: str,
    *,
    params: dict | None = None,
    out_schema: None = None,
) -> Any
get(
    path,
    *,
    params=None,
    out_schema=None,
    status_code=False,
    raise_status=True,
)

Make a GET request.

PARAMETER DESCRIPTION
path

The path to request (will be appended to endpoint)

TYPE: str

params

Query parameters

TYPE: dict | None DEFAULT: None

out_schema

Optional Pydantic schema for response validation

TYPE: type[_Schema[T]] | None DEFAULT: None

RETURNS DESCRIPTION
Any

The response data, optionally validated through out_schema

Source code in tigrbl_client/_crud.py
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
def get(
    self,
    path: str,
    *,
    params: dict | None = None,
    out_schema: type[_Schema[T]] | None = None,
    status_code: bool = False,
    raise_status: bool = True,
) -> Any:
    """
    Make a GET request.

    Args:
        path: The path to request (will be appended to endpoint)
        params: Query parameters
        out_schema: Optional Pydantic schema for response validation

    Returns:
        The response data, optionally validated through out_schema
    """
    url = self._build_url(path)
    headers = getattr(self, "_headers", {})
    response = self._get_client().get(url, params=params, headers=headers)
    return self._process_response(
        response, out_schema, status_code=status_code, raise_status=raise_status
    )

post

post(
    path: str,
    *,
    data: _Schema[Any] | dict | None = None,
    out_schema: type[_Schema[T]],
) -> T
post(
    path: str,
    *,
    data: _Schema[Any] | dict | None = None,
    out_schema: None = None,
) -> Any
post(
    path,
    *,
    data=None,
    out_schema=None,
    status_code=False,
    raise_status=True,
)

Make a POST request.

PARAMETER DESCRIPTION
path

The path to request (will be appended to endpoint)

TYPE: str

data

Data to send in request body

TYPE: _Schema[Any] | dict | None DEFAULT: None

out_schema

Optional Pydantic schema for response validation

TYPE: type[_Schema[T]] | None DEFAULT: None

RETURNS DESCRIPTION
Any

The response data, optionally validated through out_schema

Source code in tigrbl_client/_crud.py
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
def post(
    self,
    path: str,
    *,
    data: _Schema[Any] | dict | None = None,
    out_schema: type[_Schema[T]] | None = None,
    status_code: bool = False,
    raise_status: bool = True,
) -> Any:
    """
    Make a POST request.

    Args:
        path: The path to request (will be appended to endpoint)
        data: Data to send in request body
        out_schema: Optional Pydantic schema for response validation

    Returns:
        The response data, optionally validated through out_schema
    """
    url = self._build_url(path)
    json_data = self._prepare_data(data)
    headers = {"Content-Type": "application/json"}
    headers.update(getattr(self, "_headers", {}))
    response = self._get_client().post(url, json=json_data, headers=headers)
    return self._process_response(
        response, out_schema, status_code=status_code, raise_status=raise_status
    )

put

put(
    path: str,
    *,
    data: _Schema[Any] | dict | None = None,
    out_schema: type[_Schema[T]],
) -> T
put(
    path: str,
    *,
    data: _Schema[Any] | dict | None = None,
    out_schema: None = None,
) -> Any
put(
    path,
    *,
    data=None,
    out_schema=None,
    status_code=False,
    raise_status=True,
)

Make a PUT request.

PARAMETER DESCRIPTION
path

The path to request (will be appended to endpoint)

TYPE: str

data

Data to send in request body

TYPE: _Schema[Any] | dict | None DEFAULT: None

out_schema

Optional Pydantic schema for response validation

TYPE: type[_Schema[T]] | None DEFAULT: None

RETURNS DESCRIPTION
Any

The response data, optionally validated through out_schema

Source code in tigrbl_client/_crud.py
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
def put(
    self,
    path: str,
    *,
    data: _Schema[Any] | dict | None = None,
    out_schema: type[_Schema[T]] | None = None,
    status_code: bool = False,
    raise_status: bool = True,
) -> Any:
    """
    Make a PUT request.

    Args:
        path: The path to request (will be appended to endpoint)
        data: Data to send in request body
        out_schema: Optional Pydantic schema for response validation

    Returns:
        The response data, optionally validated through out_schema
    """
    url = self._build_url(path)
    json_data = self._prepare_data(data)
    headers = {"Content-Type": "application/json"}
    headers.update(getattr(self, "_headers", {}))
    response = self._get_client().put(url, json=json_data, headers=headers)
    return self._process_response(
        response, out_schema, status_code=status_code, raise_status=raise_status
    )

patch

patch(
    path: str,
    *,
    data: _Schema[Any] | dict | None = None,
    out_schema: type[_Schema[T]],
) -> T
patch(
    path: str,
    *,
    data: _Schema[Any] | dict | None = None,
    out_schema: None = None,
) -> Any
patch(
    path,
    *,
    data=None,
    out_schema=None,
    status_code=False,
    raise_status=True,
)

Make a PATCH request.

PARAMETER DESCRIPTION
path

The path to request (will be appended to endpoint)

TYPE: str

data

Data to send in request body

TYPE: _Schema[Any] | dict | None DEFAULT: None

out_schema

Optional Pydantic schema for response validation

TYPE: type[_Schema[T]] | None DEFAULT: None

RETURNS DESCRIPTION
Any

The response data, optionally validated through out_schema

Source code in tigrbl_client/_crud.py
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
def patch(
    self,
    path: str,
    *,
    data: _Schema[Any] | dict | None = None,
    out_schema: type[_Schema[T]] | None = None,
    status_code: bool = False,
    raise_status: bool = True,
) -> Any:
    """
    Make a PATCH request.

    Args:
        path: The path to request (will be appended to endpoint)
        data: Data to send in request body
        out_schema: Optional Pydantic schema for response validation

    Returns:
        The response data, optionally validated through out_schema
    """
    url = self._build_url(path)
    json_data = self._prepare_data(data)
    headers = {"Content-Type": "application/json"}
    headers.update(getattr(self, "_headers", {}))
    response = self._get_client().patch(url, json=json_data, headers=headers)
    return self._process_response(
        response, out_schema, status_code=status_code, raise_status=raise_status
    )

delete

delete(path: str, *, out_schema: type[_Schema[T]]) -> T
delete(path: str, *, out_schema: None = None) -> Any
delete(
    path,
    *,
    out_schema=None,
    status_code=False,
    raise_status=True,
)

Make a DELETE request.

PARAMETER DESCRIPTION
path

The path to request (will be appended to endpoint)

TYPE: str

out_schema

Optional Pydantic schema for response validation

TYPE: type[_Schema[T]] | None DEFAULT: None

RETURNS DESCRIPTION
Any

The response data, optionally validated through out_schema

Source code in tigrbl_client/_crud.py
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
def delete(
    self,
    path: str,
    *,
    out_schema: type[_Schema[T]] | None = None,
    status_code: bool = False,
    raise_status: bool = True,
) -> Any:
    """
    Make a DELETE request.

    Args:
        path: The path to request (will be appended to endpoint)
        out_schema: Optional Pydantic schema for response validation

    Returns:
        The response data, optionally validated through out_schema
    """
    url = self._build_url(path)
    headers = getattr(self, "_headers", {})
    response = self._get_client().delete(url, headers=headers)
    return self._process_response(
        response, out_schema, status_code=status_code, raise_status=raise_status
    )

aget async

aget(
    path: str,
    *,
    params: dict | None = None,
    out_schema: type[_Schema[T]],
) -> T
aget(
    path: str,
    *,
    params: dict | None = None,
    out_schema: None = None,
) -> Any
aget(
    path,
    *,
    params=None,
    out_schema=None,
    status_code=False,
    raise_status=True,
)

Make an async GET request.

PARAMETER DESCRIPTION
path

The path to request (will be appended to endpoint)

TYPE: str

params

Query parameters

TYPE: dict | None DEFAULT: None

out_schema

Optional Pydantic schema for response validation

TYPE: type[_Schema[T]] | None DEFAULT: None

RETURNS DESCRIPTION
Any

The response data, optionally validated through out_schema

Source code in tigrbl_client/_crud.py
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
async def aget(
    self,
    path: str,
    *,
    params: dict | None = None,
    out_schema: type[_Schema[T]] | None = None,
    status_code: bool = False,
    raise_status: bool = True,
) -> Any:
    """
    Make an async GET request.

    Args:
        path: The path to request (will be appended to endpoint)
        params: Query parameters
        out_schema: Optional Pydantic schema for response validation

    Returns:
        The response data, optionally validated through out_schema
    """
    url = self._build_url(path)
    headers = getattr(self, "_headers", {})
    response = await self._get_async_client().get(
        url, params=params, headers=headers
    )
    return self._process_response(
        response, out_schema, status_code=status_code, raise_status=raise_status
    )

apost async

apost(
    path: str,
    *,
    data: _Schema[Any] | dict | None = None,
    out_schema: type[_Schema[T]],
) -> T
apost(
    path: str,
    *,
    data: _Schema[Any] | dict | None = None,
    out_schema: None = None,
) -> Any
apost(
    path,
    *,
    data=None,
    out_schema=None,
    status_code=False,
    raise_status=True,
)

Make an async POST request.

PARAMETER DESCRIPTION
path

The path to request (will be appended to endpoint)

TYPE: str

data

Data to send in request body

TYPE: _Schema[Any] | dict | None DEFAULT: None

out_schema

Optional Pydantic schema for response validation

TYPE: type[_Schema[T]] | None DEFAULT: None

RETURNS DESCRIPTION
Any

The response data, optionally validated through out_schema

Source code in tigrbl_client/_crud.py
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
async def apost(
    self,
    path: str,
    *,
    data: _Schema[Any] | dict | None = None,
    out_schema: type[_Schema[T]] | None = None,
    status_code: bool = False,
    raise_status: bool = True,
) -> Any:
    """
    Make an async POST request.

    Args:
        path: The path to request (will be appended to endpoint)
        data: Data to send in request body
        out_schema: Optional Pydantic schema for response validation

    Returns:
        The response data, optionally validated through out_schema
    """
    url = self._build_url(path)
    json_data = self._prepare_data(data)
    headers = {"Content-Type": "application/json"}
    headers.update(getattr(self, "_headers", {}))
    response = await self._get_async_client().post(
        url, json=json_data, headers=headers
    )
    return self._process_response(
        response, out_schema, status_code=status_code, raise_status=raise_status
    )

aput async

aput(
    path: str,
    *,
    data: _Schema[Any] | dict | None = None,
    out_schema: type[_Schema[T]],
) -> T
aput(
    path: str,
    *,
    data: _Schema[Any] | dict | None = None,
    out_schema: None = None,
) -> Any
aput(
    path,
    *,
    data=None,
    out_schema=None,
    status_code=False,
    raise_status=True,
)

Make an async PUT request.

PARAMETER DESCRIPTION
path

The path to request (will be appended to endpoint)

TYPE: str

data

Data to send in request body

TYPE: _Schema[Any] | dict | None DEFAULT: None

out_schema

Optional Pydantic schema for response validation

TYPE: type[_Schema[T]] | None DEFAULT: None

RETURNS DESCRIPTION
Any

The response data, optionally validated through out_schema

Source code in tigrbl_client/_crud.py
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
async def aput(
    self,
    path: str,
    *,
    data: _Schema[Any] | dict | None = None,
    out_schema: type[_Schema[T]] | None = None,
    status_code: bool = False,
    raise_status: bool = True,
) -> Any:
    """
    Make an async PUT request.

    Args:
        path: The path to request (will be appended to endpoint)
        data: Data to send in request body
        out_schema: Optional Pydantic schema for response validation

    Returns:
        The response data, optionally validated through out_schema
    """
    url = self._build_url(path)
    json_data = self._prepare_data(data)
    headers = {"Content-Type": "application/json"}
    headers.update(getattr(self, "_headers", {}))
    response = await self._get_async_client().put(
        url, json=json_data, headers=headers
    )
    return self._process_response(
        response, out_schema, status_code=status_code, raise_status=raise_status
    )

apatch async

apatch(
    path: str,
    *,
    data: _Schema[Any] | dict | None = None,
    out_schema: type[_Schema[T]],
) -> T
apatch(
    path: str,
    *,
    data: _Schema[Any] | dict | None = None,
    out_schema: None = None,
) -> Any
apatch(
    path,
    *,
    data=None,
    out_schema=None,
    status_code=False,
    raise_status=True,
)

Make an async PATCH request.

PARAMETER DESCRIPTION
path

The path to request (will be appended to endpoint)

TYPE: str

data

Data to send in request body

TYPE: _Schema[Any] | dict | None DEFAULT: None

out_schema

Optional Pydantic schema for response validation

TYPE: type[_Schema[T]] | None DEFAULT: None

RETURNS DESCRIPTION
Any

The response data, optionally validated through out_schema

Source code in tigrbl_client/_crud.py
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
async def apatch(
    self,
    path: str,
    *,
    data: _Schema[Any] | dict | None = None,
    out_schema: type[_Schema[T]] | None = None,
    status_code: bool = False,
    raise_status: bool = True,
) -> Any:
    """
    Make an async PATCH request.

    Args:
        path: The path to request (will be appended to endpoint)
        data: Data to send in request body
        out_schema: Optional Pydantic schema for response validation

    Returns:
        The response data, optionally validated through out_schema
    """
    url = self._build_url(path)
    json_data = self._prepare_data(data)
    headers = {"Content-Type": "application/json"}
    headers.update(getattr(self, "_headers", {}))
    response = await self._get_async_client().patch(
        url, json=json_data, headers=headers
    )
    return self._process_response(
        response, out_schema, status_code=status_code, raise_status=raise_status
    )

adelete async

adelete(path: str, *, out_schema: type[_Schema[T]]) -> T
adelete(path: str, *, out_schema: None = None) -> Any
adelete(
    path,
    *,
    out_schema=None,
    status_code=False,
    raise_status=True,
)

Make an async DELETE request.

PARAMETER DESCRIPTION
path

The path to request (will be appended to endpoint)

TYPE: str

out_schema

Optional Pydantic schema for response validation

TYPE: type[_Schema[T]] | None DEFAULT: None

RETURNS DESCRIPTION
Any

The response data, optionally validated through out_schema

Source code in tigrbl_client/_crud.py
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
async def adelete(
    self,
    path: str,
    *,
    out_schema: type[_Schema[T]] | None = None,
    status_code: bool = False,
    raise_status: bool = True,
) -> Any:
    """
    Make an async DELETE request.

    Args:
        path: The path to request (will be appended to endpoint)
        out_schema: Optional Pydantic schema for response validation

    Returns:
        The response data, optionally validated through out_schema
    """
    url = self._build_url(path)
    headers = getattr(self, "_headers", {})
    response = await self._get_async_client().delete(url, headers=headers)
    return self._process_response(
        response, out_schema, status_code=status_code, raise_status=raise_status
    )