inttegro.async_resources.children_policies

Children-policy operations.

 1# Generated by scripts/generate_async_resources.py; do not edit by hand.
 2"""Children-policy operations."""
 3from __future__ import annotations
 4from typing import cast
 5from ..async_http_client import AsyncHttpClient
 6from inttegro.children_policy import ChildrenPolicy, LookupRequest, Page, PageRequest
 7
 8class AsyncChildrenPolicies:
 9    """Look up the authenticated application's active children policy."""
10
11    def __init__(self, http: AsyncHttpClient) -> None:
12        self.http = http
13
14    async def lookup(self, version: int | LookupRequest | None=None) -> ChildrenPolicy:
15        """Return the latest policy by default, or one exact immutable version."""
16        if isinstance(version, LookupRequest):
17            payload = version
18        elif version is None:
19            payload = LookupRequest()
20        else:
21            payload = LookupRequest(version=version)
22        return cast(ChildrenPolicy, await self.http.post('/children_policies/lookup', payload))
23
24    async def page(self, payload: PageRequest | None=None) -> Page:
25        """List immutable versions of the authenticated application's policy."""
26        return cast(Page, await self.http.post('/children_policies/page', payload or PageRequest()))
class AsyncChildrenPolicies:
 9class AsyncChildrenPolicies:
10    """Look up the authenticated application's active children policy."""
11
12    def __init__(self, http: AsyncHttpClient) -> None:
13        self.http = http
14
15    async def lookup(self, version: int | LookupRequest | None=None) -> ChildrenPolicy:
16        """Return the latest policy by default, or one exact immutable version."""
17        if isinstance(version, LookupRequest):
18            payload = version
19        elif version is None:
20            payload = LookupRequest()
21        else:
22            payload = LookupRequest(version=version)
23        return cast(ChildrenPolicy, await self.http.post('/children_policies/lookup', payload))
24
25    async def page(self, payload: PageRequest | None=None) -> Page:
26        """List immutable versions of the authenticated application's policy."""
27        return cast(Page, await self.http.post('/children_policies/page', payload or PageRequest()))

Look up the authenticated application's active children policy.

AsyncChildrenPolicies(http: inttegro.async_http_client.AsyncHttpClient)
12    def __init__(self, http: AsyncHttpClient) -> None:
13        self.http = http
http
async def lookup( self, version: int | inttegro.children_policy.LookupRequest | None = None) -> inttegro.children_policy.ChildrenPolicy:
15    async def lookup(self, version: int | LookupRequest | None=None) -> ChildrenPolicy:
16        """Return the latest policy by default, or one exact immutable version."""
17        if isinstance(version, LookupRequest):
18            payload = version
19        elif version is None:
20            payload = LookupRequest()
21        else:
22            payload = LookupRequest(version=version)
23        return cast(ChildrenPolicy, await self.http.post('/children_policies/lookup', payload))

Return the latest policy by default, or one exact immutable version.

async def page( self, payload: inttegro.children_policy.PageRequest | None = None) -> inttegro.children_policy.Page:
25    async def page(self, payload: PageRequest | None=None) -> Page:
26        """List immutable versions of the authenticated application's policy."""
27        return cast(Page, await self.http.post('/children_policies/page', payload or PageRequest()))

List immutable versions of the authenticated application's policy.