Merge branch 'main' into mirror/main

This commit is contained in:
michaelachrisco 2024-10-25 10:14:05 -07:00
commit 01bc3847b9
600 changed files with 67688 additions and 0 deletions

3
.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
venv
usage-example.py
__pycache__

View file

@ -0,0 +1,7 @@
""" A client library for accessing Authentication """
from .client import AuthenticatedClient, Client
__all__ = (
"AuthenticatedClient",
"Client",
)

View file

@ -0,0 +1 @@
""" Contains methods for accessing the API """

View file

@ -0,0 +1,115 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...types import Response
def _get_kwargs() -> Dict[str, Any]:
pass
return {
"method": "post",
"url": "/oauth2/authorize",
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
*,
client: Union[AuthenticatedClient, Client],
) -> Response[Any]:
"""Get Authorization Code
Gets an authorization code (for authorization code flow) or access token (for implicit flow) from
the authentication server.
This API is used for the following:
- [Authorization Code Flow](../construct-authCodeFlow.html) - set the request parameter
response_type=code. If successful, the authorization code will be returned in the response body. Use
the authorization code to get the access token from [Get Access Token](#operation/oauth2.token).
- [Implicit Flow](../construct-implicitFlow.html) - set the request parameter response_type=token.
If successful, the access token will be returned in the access_token parameter in the redirect URL.
**Note**: You can invoke this API using the HTTP GET method. In which case, specify the described
request body fields as request query parameters.
**API Endpoint**: POST /oauth2/authorize
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs()
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
*,
client: Union[AuthenticatedClient, Client],
) -> Response[Any]:
"""Get Authorization Code
Gets an authorization code (for authorization code flow) or access token (for implicit flow) from
the authentication server.
This API is used for the following:
- [Authorization Code Flow](../construct-authCodeFlow.html) - set the request parameter
response_type=code. If successful, the authorization code will be returned in the response body. Use
the authorization code to get the access token from [Get Access Token](#operation/oauth2.token).
- [Implicit Flow](../construct-implicitFlow.html) - set the request parameter response_type=token.
If successful, the access token will be returned in the access_token parameter in the redirect URL.
**Note**: You can invoke this API using the HTTP GET method. In which case, specify the described
request body fields as request query parameters.
**API Endpoint**: POST /oauth2/authorize
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs()
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)

View file

@ -0,0 +1,147 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...types import Response
def _get_kwargs(
*,
content_type: str,
x_accela_appid: str,
) -> Dict[str, Any]:
headers = {}
headers["Content-Type"] = content_type
headers["x-accela-appid"] = x_accela_appid
return {
"method": "post",
"url": "/oauth2/token",
"headers": headers,
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
*,
client: Union[AuthenticatedClient, Client],
content_type: str,
x_accela_appid: str,
) -> Response[Any]:
"""Get Access Token
Gets an access token from the authentication server.
This API is used for the following:
- [Authorization Code Flow](../construct-authCodeFlow.html) - set the request parameter
grant_type=authorization_code.
- [Password Credential Login](../construct-passwordCredentialLogin.html) - set the request parameter
grant_type=password.
- Refreshing the token - set the request parameter grant_type=refresh_token. Access tokens have a
limited lifetime and, in some cases, an application needs access to an API beyond the lifetime of a
single access token. When this is the case, your application can obtain a new access token using the
refresh token. Your app can refresh the token before it expires or when it expires, according your
app requirements or workflow.
**API Endpoint**: POST /oauth2/token
Args:
content_type (str):
x_accela_appid (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
content_type=content_type,
x_accela_appid=x_accela_appid,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
*,
client: Union[AuthenticatedClient, Client],
content_type: str,
x_accela_appid: str,
) -> Response[Any]:
"""Get Access Token
Gets an access token from the authentication server.
This API is used for the following:
- [Authorization Code Flow](../construct-authCodeFlow.html) - set the request parameter
grant_type=authorization_code.
- [Password Credential Login](../construct-passwordCredentialLogin.html) - set the request parameter
grant_type=password.
- Refreshing the token - set the request parameter grant_type=refresh_token. Access tokens have a
limited lifetime and, in some cases, an application needs access to an API beyond the lifetime of a
single access token. When this is the case, your application can obtain a new access token using the
refresh token. Your app can refresh the token before it expires or when it expires, according your
app requirements or workflow.
**API Endpoint**: POST /oauth2/token
Args:
content_type (str):
x_accela_appid (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
content_type=content_type,
x_accela_appid=x_accela_appid,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)

View file

@ -0,0 +1,110 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...types import Response
def _get_kwargs(
*,
authorization: str,
) -> Dict[str, Any]:
headers = {}
headers["Authorization"] = authorization
return {
"method": "get",
"url": "/oauth2/tokeninfo",
"headers": headers,
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
*,
client: Union[AuthenticatedClient, Client],
authorization: str,
) -> Response[Any]:
"""Get Token Info
Validates a given access token in the *Authorization* http header, and returns the token
information. Use the token information to match it with the information used to request the access
token.
**API Endpoint**: GET /oauth2/tokeninfo
Args:
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
authorization=authorization,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
*,
client: Union[AuthenticatedClient, Client],
authorization: str,
) -> Response[Any]:
"""Get Token Info
Validates a given access token in the *Authorization* http header, and returns the token
information. Use the token information to match it with the information used to request the access
token.
**API Endpoint**: GET /oauth2/tokeninfo
Args:
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
authorization=authorization,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)

View file

@ -0,0 +1,268 @@
import ssl
from typing import Any, Dict, Optional, Union
import httpx
from attrs import define, evolve, field
@define
class Client:
"""A class for keeping track of data related to the API
The following are accepted as keyword arguments and will be used to construct httpx Clients internally:
``base_url``: The base URL for the API, all requests are made to a relative path to this URL
``cookies``: A dictionary of cookies to be sent with every request
``headers``: A dictionary of headers to be sent with every request
``timeout``: The maximum amount of a time a request can take. API functions will raise
httpx.TimeoutException if this is exceeded.
``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production,
but can be set to False for testing purposes.
``follow_redirects``: Whether or not to follow redirects. Default value is False.
``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor.
Attributes:
raise_on_unexpected_status: Whether or not to raise an errors.UnexpectedStatus if the API returns a
status code that was not documented in the source OpenAPI document. Can also be provided as a keyword
argument to the constructor.
"""
raise_on_unexpected_status: bool = field(default=False, kw_only=True)
_base_url: str
_cookies: Dict[str, str] = field(factory=dict, kw_only=True)
_headers: Dict[str, str] = field(factory=dict, kw_only=True)
_timeout: Optional[httpx.Timeout] = field(default=None, kw_only=True)
_verify_ssl: Union[str, bool, ssl.SSLContext] = field(default=True, kw_only=True)
_follow_redirects: bool = field(default=False, kw_only=True)
_httpx_args: Dict[str, Any] = field(factory=dict, kw_only=True)
_client: Optional[httpx.Client] = field(default=None, init=False)
_async_client: Optional[httpx.AsyncClient] = field(default=None, init=False)
def with_headers(self, headers: Dict[str, str]) -> "Client":
"""Get a new client matching this one with additional headers"""
if self._client is not None:
self._client.headers.update(headers)
if self._async_client is not None:
self._async_client.headers.update(headers)
return evolve(self, headers={**self._headers, **headers})
def with_cookies(self, cookies: Dict[str, str]) -> "Client":
"""Get a new client matching this one with additional cookies"""
if self._client is not None:
self._client.cookies.update(cookies)
if self._async_client is not None:
self._async_client.cookies.update(cookies)
return evolve(self, cookies={**self._cookies, **cookies})
def with_timeout(self, timeout: httpx.Timeout) -> "Client":
"""Get a new client matching this one with a new timeout (in seconds)"""
if self._client is not None:
self._client.timeout = timeout
if self._async_client is not None:
self._async_client.timeout = timeout
return evolve(self, timeout=timeout)
def set_httpx_client(self, client: httpx.Client) -> "Client":
"""Manually the underlying httpx.Client
**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
"""
self._client = client
return self
def get_httpx_client(self) -> httpx.Client:
"""Get the underlying httpx.Client, constructing a new one if not previously set"""
if self._client is None:
self._client = httpx.Client(
base_url=self._base_url,
cookies=self._cookies,
headers=self._headers,
timeout=self._timeout,
verify=self._verify_ssl,
follow_redirects=self._follow_redirects,
**self._httpx_args,
)
return self._client
def __enter__(self) -> "Client":
"""Enter a context manager for self.client—you cannot enter twice (see httpx docs)"""
self.get_httpx_client().__enter__()
return self
def __exit__(self, *args: Any, **kwargs: Any) -> None:
"""Exit a context manager for internal httpx.Client (see httpx docs)"""
self.get_httpx_client().__exit__(*args, **kwargs)
def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> "Client":
"""Manually the underlying httpx.AsyncClient
**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
"""
self._async_client = async_client
return self
def get_async_httpx_client(self) -> httpx.AsyncClient:
"""Get the underlying httpx.AsyncClient, constructing a new one if not previously set"""
if self._async_client is None:
self._async_client = httpx.AsyncClient(
base_url=self._base_url,
cookies=self._cookies,
headers=self._headers,
timeout=self._timeout,
verify=self._verify_ssl,
follow_redirects=self._follow_redirects,
**self._httpx_args,
)
return self._async_client
async def __aenter__(self) -> "Client":
"""Enter a context manager for underlying httpx.AsyncClient—you cannot enter twice (see httpx docs)"""
await self.get_async_httpx_client().__aenter__()
return self
async def __aexit__(self, *args: Any, **kwargs: Any) -> None:
"""Exit a context manager for underlying httpx.AsyncClient (see httpx docs)"""
await self.get_async_httpx_client().__aexit__(*args, **kwargs)
@define
class AuthenticatedClient:
"""A Client which has been authenticated for use on secured endpoints
The following are accepted as keyword arguments and will be used to construct httpx Clients internally:
``base_url``: The base URL for the API, all requests are made to a relative path to this URL
``cookies``: A dictionary of cookies to be sent with every request
``headers``: A dictionary of headers to be sent with every request
``timeout``: The maximum amount of a time a request can take. API functions will raise
httpx.TimeoutException if this is exceeded.
``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production,
but can be set to False for testing purposes.
``follow_redirects``: Whether or not to follow redirects. Default value is False.
``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor.
Attributes:
raise_on_unexpected_status: Whether or not to raise an errors.UnexpectedStatus if the API returns a
status code that was not documented in the source OpenAPI document. Can also be provided as a keyword
argument to the constructor.
token: The token to use for authentication
prefix: The prefix to use for the Authorization header
auth_header_name: The name of the Authorization header
"""
raise_on_unexpected_status: bool = field(default=False, kw_only=True)
_base_url: str
_cookies: Dict[str, str] = field(factory=dict, kw_only=True)
_headers: Dict[str, str] = field(factory=dict, kw_only=True)
_timeout: Optional[httpx.Timeout] = field(default=None, kw_only=True)
_verify_ssl: Union[str, bool, ssl.SSLContext] = field(default=True, kw_only=True)
_follow_redirects: bool = field(default=False, kw_only=True)
_httpx_args: Dict[str, Any] = field(factory=dict, kw_only=True)
_client: Optional[httpx.Client] = field(default=None, init=False)
_async_client: Optional[httpx.AsyncClient] = field(default=None, init=False)
token: str
prefix: str = "Bearer"
auth_header_name: str = "Authorization"
def with_headers(self, headers: Dict[str, str]) -> "AuthenticatedClient":
"""Get a new client matching this one with additional headers"""
if self._client is not None:
self._client.headers.update(headers)
if self._async_client is not None:
self._async_client.headers.update(headers)
return evolve(self, headers={**self._headers, **headers})
def with_cookies(self, cookies: Dict[str, str]) -> "AuthenticatedClient":
"""Get a new client matching this one with additional cookies"""
if self._client is not None:
self._client.cookies.update(cookies)
if self._async_client is not None:
self._async_client.cookies.update(cookies)
return evolve(self, cookies={**self._cookies, **cookies})
def with_timeout(self, timeout: httpx.Timeout) -> "AuthenticatedClient":
"""Get a new client matching this one with a new timeout (in seconds)"""
if self._client is not None:
self._client.timeout = timeout
if self._async_client is not None:
self._async_client.timeout = timeout
return evolve(self, timeout=timeout)
def set_httpx_client(self, client: httpx.Client) -> "AuthenticatedClient":
"""Manually the underlying httpx.Client
**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
"""
self._client = client
return self
def get_httpx_client(self) -> httpx.Client:
"""Get the underlying httpx.Client, constructing a new one if not previously set"""
if self._client is None:
self._headers[self.auth_header_name] = f"{self.prefix} {self.token}" if self.prefix else self.token
self._client = httpx.Client(
base_url=self._base_url,
cookies=self._cookies,
headers=self._headers,
timeout=self._timeout,
verify=self._verify_ssl,
follow_redirects=self._follow_redirects,
**self._httpx_args,
)
return self._client
def __enter__(self) -> "AuthenticatedClient":
"""Enter a context manager for self.client—you cannot enter twice (see httpx docs)"""
self.get_httpx_client().__enter__()
return self
def __exit__(self, *args: Any, **kwargs: Any) -> None:
"""Exit a context manager for internal httpx.Client (see httpx docs)"""
self.get_httpx_client().__exit__(*args, **kwargs)
def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> "AuthenticatedClient":
"""Manually the underlying httpx.AsyncClient
**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
"""
self._async_client = async_client
return self
def get_async_httpx_client(self) -> httpx.AsyncClient:
"""Get the underlying httpx.AsyncClient, constructing a new one if not previously set"""
if self._async_client is None:
self._headers[self.auth_header_name] = f"{self.prefix} {self.token}" if self.prefix else self.token
self._async_client = httpx.AsyncClient(
base_url=self._base_url,
cookies=self._cookies,
headers=self._headers,
timeout=self._timeout,
verify=self._verify_ssl,
follow_redirects=self._follow_redirects,
**self._httpx_args,
)
return self._async_client
async def __aenter__(self) -> "AuthenticatedClient":
"""Enter a context manager for underlying httpx.AsyncClient—you cannot enter twice (see httpx docs)"""
await self.get_async_httpx_client().__aenter__()
return self
async def __aexit__(self, *args: Any, **kwargs: Any) -> None:
"""Exit a context manager for underlying httpx.AsyncClient (see httpx docs)"""
await self.get_async_httpx_client().__aexit__(*args, **kwargs)

View file

@ -0,0 +1,14 @@
""" Contains shared errors types that can be raised from API functions """
class UnexpectedStatus(Exception):
"""Raised by api functions when the response status an undocumented status and Client.raise_on_unexpected_status is True"""
def __init__(self, status_code: int, content: bytes):
self.status_code = status_code
self.content = content
super().__init__(f"Unexpected status code: {status_code}")
__all__ = ["UnexpectedStatus"]

View file

@ -0,0 +1,23 @@
""" Contains all the data models used in inputs/outputs """
from .request_authorize import RequestAuthorize
from .request_authorize_response_type import RequestAuthorizeResponseType
from .request_token import RequestToken
from .request_token_grant_type import RequestTokenGrantType
from .response_authorize import ResponseAuthorize
from .response_error import ResponseError
from .response_status import ResponseStatus
from .response_token import ResponseToken
from .response_tokeninfo import ResponseTokeninfo
__all__ = (
"RequestAuthorize",
"RequestAuthorizeResponseType",
"RequestToken",
"RequestTokenGrantType",
"ResponseAuthorize",
"ResponseError",
"ResponseStatus",
"ResponseToken",
"ResponseTokeninfo",
)

View file

@ -0,0 +1,145 @@
from typing import Any, Dict, List, Type, TypeVar, Union
from attrs import define as _attrs_define
from attrs import field as _attrs_field
from ..models.request_authorize_response_type import RequestAuthorizeResponseType
from ..types import UNSET, Unset
T = TypeVar("T", bound="RequestAuthorize")
@_attrs_define
class RequestAuthorize:
"""
Attributes:
response_type (RequestAuthorizeResponseType): Specifies whether the request is for an authorization code or
access token.
Valid values:
*code* - Request for an authorization code. See [Authorization Code Flow](../construct-authCodeFlow.html).
*token* - Request for an access token. See [Implicit Flow](../construct-implicitFlow.html).
client_id (str): The app ID value from [Construct Developer Portal](https://developer.accela.com).
redirect_uri (str): The URI that is used to redirect to the client with an authorization code. This must be a
valid URL.
**Note**: Special characters in the URL should be encoded.
environment (str): The Construct environment name, such as "PROD" and "TEST". The [Get All Agency
Environments](./api-agencies.html#operation/v4.get.agencies.name.environments) API returns a list of configured
environments available for a specific agency. The [Get Environment Status](./api-
agencies.html#operation/v4.get.agencies.name.environments.env.status) checks connectivity with the
Agency/Environment.
agency_name (str): The agency name defined in [Construct Administrator Portal](https://admin.accela.com). APIs
such as [Get All Agencies](./api-agencies.html#operation/v4.get.agencies), [Get Agency](./api-
agencies.html#operation/v4.get.agencies.name), and [Search Agencies](./api-
search.html#operation/v4.post.search.agencies) return valid agency names.
**Note**: For an **agency app**, agency is required.
For a **citizen app** that use dynamic agency routing functionality, agency_name is optional.
forcelogin (Union[Unset, bool]): Indicates whether or not Accela Auth server forces end-user login each time
client requests access token.
Valid values:
*true*: Always force end-user login.
*false*: Do not force end-user login. The sever determines if the current request needs login. This is the
default behavior.
scope (Union[Unset, str]): The scope of the resources that the client requests. Enter a list of APIs scope names
separated by spaces. Get the scope names from the [Accela API Reference](./api-index.html).
state (Union[Unset, str]): An opaque value that the client uses for maintaining the state between the request
and callback. Enter a unique value. This can be used for [Cross-Site Request
Forgery](http://en.wikipedia.org/wiki/Cross-site_request_forgery) (CSRF) protection.
"""
response_type: RequestAuthorizeResponseType
client_id: str
redirect_uri: str
environment: str
agency_name: str
forcelogin: Union[Unset, bool] = UNSET
scope: Union[Unset, str] = UNSET
state: Union[Unset, str] = UNSET
additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
response_type = self.response_type.value
client_id = self.client_id
redirect_uri = self.redirect_uri
environment = self.environment
agency_name = self.agency_name
forcelogin = self.forcelogin
scope = self.scope
state = self.state
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update(
{
"response_type": response_type,
"client_id": client_id,
"redirect_uri": redirect_uri,
"environment": environment,
"agency_name": agency_name,
}
)
if forcelogin is not UNSET:
field_dict["forcelogin"] = forcelogin
if scope is not UNSET:
field_dict["scope"] = scope
if state is not UNSET:
field_dict["state"] = state
return field_dict
@classmethod
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
d = src_dict.copy()
response_type = RequestAuthorizeResponseType(d.pop("response_type"))
client_id = d.pop("client_id")
redirect_uri = d.pop("redirect_uri")
environment = d.pop("environment")
agency_name = d.pop("agency_name")
forcelogin = d.pop("forcelogin", UNSET)
scope = d.pop("scope", UNSET)
state = d.pop("state", UNSET)
request_authorize = cls(
response_type=response_type,
client_id=client_id,
redirect_uri=redirect_uri,
environment=environment,
agency_name=agency_name,
forcelogin=forcelogin,
scope=scope,
state=state,
)
request_authorize.additional_properties = d
return request_authorize
@property
def additional_keys(self) -> List[str]:
return list(self.additional_properties.keys())
def __getitem__(self, key: str) -> Any:
return self.additional_properties[key]
def __setitem__(self, key: str, value: Any) -> None:
self.additional_properties[key] = value
def __delitem__(self, key: str) -> None:
del self.additional_properties[key]
def __contains__(self, key: str) -> bool:
return key in self.additional_properties

View file

@ -0,0 +1,9 @@
from enum import Enum
class RequestAuthorizeResponseType(str, Enum):
CODE = "code"
TOKEN = "token"
def __str__(self) -> str:
return str(self.value)

View file

@ -0,0 +1,208 @@
from typing import Any, Dict, List, Type, TypeVar, Union
from attrs import define as _attrs_define
from attrs import field as _attrs_field
from ..models.request_token_grant_type import RequestTokenGrantType
from ..types import UNSET, Unset
T = TypeVar("T", bound="RequestToken")
@_attrs_define
class RequestToken:
"""
Attributes:
client_id (str): The app ID value from [Construct Developer Portal](https://developer.accela.com).
client_secret (str): The app secret value from [Construct Developer Portal](https://developer.accela.com).
grant_type (RequestTokenGrantType): Specifies whether the request is for an authorization code, password
credential access token, or refresh token. Valid values:
Values:
authorization_code - Request to exchange the given authorization code with an access token. Used with
[Authorization Code Flow](../construct-authCodeFlow.html).
password - Request authentication via userid and password credential. See [Password Credential
Login](../construct-passwordCredentialLogin.html).
refresh_token - Request to refresh the token.
**Note**: Make sure the grant_type value does not contain any space character.
code (str): The authorization code obtained from the preceding [/oauth2/authorize](#operation/oauth2.authorize)
request.
**Note**: code is required only when calling this API with grant_type=authorization_code for [Authorization Code
Flow](../construct-authCodeFlow.html).
**Note**: The code should be URL-encoded, if you are using tools or libraries which will auto-encode the code,
you need to pass the code under decoded.
**Note**: The code can be used no more than one time, the client should apply the rule during exchange access
token.
redirect_uri (str): The URI that is used to redirect to the client with an access token.
**Note**: redirect_uri is required only when calling this API with grant_type=authorization_code for
[Authorization Code Flow](../construct-authCodeFlow.html).
**Note**: The value of redirect_uri must match the redirect_uri used in the preceding
[/oauth2/authorize](#operation/oauth2.authorize) request.
username (str): For a **citizen app**, the user name is the Civic ID.
For an **agency app**, the user name is the Civic Platform account.
**Note**: username is required only when calling this API with grant_type=password for [Password Credential
Login](../construct-passwordCredentialLogin.html).
password (str): For a **citizen app**, the user name is the Civic ID password.
For an **agency app**, the user name is the Civic Platform password.
**Note**: username is required only when calling this API with grant_type=password for [Password Credential
Login](../construct-passwordCredentialLogin.html).
agency_name (str): The agency name defined in [Construct Administrator Portal](https://admin.accela.com). APIs
such as [Get All Agencies](./api-agencies.html#operation/v4.get.agencies), [Get Agency](./api-
agencies.html#operation/v4.get.agencies.name), and [Search Agencies](./api-
search.html#operation/v4.post.search.agencies) return valid agency names.
**Note**: agency_name is used only when calling this API with grant_type=password for [Password Credential
Login](../construct-passwordCredentialLogin.html). For an **agency app**, agency_name is required.
For a **citizen app**, agency_name is optional.
environment (str): The Construct environment name, such as "PROD" and "TEST". The [Get All Agency
Environments](./api-agencies.html#operation/v4.get.agencies.name.environments) API returns a list of configured
environments available for a specific agency. The [Get Environment Status](./api-
agencies.html#operation/v4.get.agencies.name.environments.env.status) checks connectivity with the
Agency/Environment..
**Note**: scope is required only when calling this API with grant_type=password for [Password Credential
Login](../construct-passwordCredentialLogin.html).
scope (Union[Unset, str]): The scope of the resources that the client requests. Enter a list of APIs scope names
separated by spaces. Get the scope names from the [Accela API Reference](./api-index.html).
**Note**: scope is required only when calling this API with grant_type=password for [Password Credential
Login](../construct-passwordCredentialLogin.html).
refresh_token (Union[Unset, str]): The refresh token value obtained in the prior access token API request.
**Note**: refresh_token is required only when calling this API to refresh the token for both [Authorization Code
Flow](../construct-authCodeFlow.html) and [Password Credential Login](../construct-
passwordCredentialLogin.html).
state (Union[Unset, str]): An opaque value that the client uses for maintaining the state between the request
and callback. Enter a unique value. This can be used for [Cross-Site Request
Forgery](http://en.wikipedia.org/wiki/Cross-site_request_forgery) (CSRF) protection.
This parameter is not used when refreshing a token.
**Note**: state is used and optional only when calling this API with grant_type=authorization_code for
[Authorization Code Flow](../construct-authCodeFlow.html).
"""
client_id: str
client_secret: str
grant_type: RequestTokenGrantType
code: str
redirect_uri: str
username: str
password: str
agency_name: str
environment: str
scope: Union[Unset, str] = UNSET
refresh_token: Union[Unset, str] = UNSET
state: Union[Unset, str] = UNSET
additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
client_id = self.client_id
client_secret = self.client_secret
grant_type = self.grant_type.value
code = self.code
redirect_uri = self.redirect_uri
username = self.username
password = self.password
agency_name = self.agency_name
environment = self.environment
scope = self.scope
refresh_token = self.refresh_token
state = self.state
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update(
{
"client_id": client_id,
"client_secret": client_secret,
"grant_type": grant_type,
"code": code,
"redirect_uri": redirect_uri,
"username": username,
"password": password,
"agency_name": agency_name,
"environment": environment,
}
)
if scope is not UNSET:
field_dict["scope"] = scope
if refresh_token is not UNSET:
field_dict["refresh_token"] = refresh_token
if state is not UNSET:
field_dict["state"] = state
return field_dict
@classmethod
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
d = src_dict.copy()
client_id = d.pop("client_id")
client_secret = d.pop("client_secret")
grant_type = RequestTokenGrantType(d.pop("grant_type"))
code = d.pop("code")
redirect_uri = d.pop("redirect_uri")
username = d.pop("username")
password = d.pop("password")
agency_name = d.pop("agency_name")
environment = d.pop("environment")
scope = d.pop("scope", UNSET)
refresh_token = d.pop("refresh_token", UNSET)
state = d.pop("state", UNSET)
request_token = cls(
client_id=client_id,
client_secret=client_secret,
grant_type=grant_type,
code=code,
redirect_uri=redirect_uri,
username=username,
password=password,
agency_name=agency_name,
environment=environment,
scope=scope,
refresh_token=refresh_token,
state=state,
)
request_token.additional_properties = d
return request_token
@property
def additional_keys(self) -> List[str]:
return list(self.additional_properties.keys())
def __getitem__(self, key: str) -> Any:
return self.additional_properties[key]
def __setitem__(self, key: str, value: Any) -> None:
self.additional_properties[key] = value
def __delitem__(self, key: str) -> None:
del self.additional_properties[key]
def __contains__(self, key: str) -> bool:
return key in self.additional_properties

View file

@ -0,0 +1,10 @@
from enum import Enum
class RequestTokenGrantType(str, Enum):
AUTHORIZATION_CODE = "authorization_code"
PASSWORD = "password"
REFRESH_TOKEN = "refresh_token"
def __str__(self) -> str:
return str(self.value)

View file

@ -0,0 +1,137 @@
from typing import Any, Dict, List, Type, TypeVar, Union
from attrs import define as _attrs_define
from attrs import field as _attrs_field
from ..types import UNSET, Unset
T = TypeVar("T", bound="ResponseAuthorize")
@_attrs_define
class ResponseAuthorize:
"""
Attributes:
code (Union[Unset, str]): The authorization code (for an authorization code flow request where
response_type=code). The client app uses the authorization code to exchange for an access token.
environment (Union[Unset, str]): The environment name that the user selected when signing into the app (for an
authorization code flow request where response_type=code).
For an implicit flow request where response_type=token, environment is returned as a parameter in the
redirection URI using the "application/x-www-form-urlencoded" format.
agency_name (Union[Unset, str]): The agency name that the user entered when signing into the app (for an
authorization code flow request where response_type=code).
For an implicit flow request where response_type=token, agency_name is returned as a parameter in the
redirection URI using the "application/x-www-form-urlencoded" format.
state (Union[Unset, str]): The exact value received from the client (for an authorization code flow request
where response_type=code). Check this value against original state value sent in the request to verify and
protect against CSRF.
For an implicit flow request where response_type=token, state is returned as a parameter in the redirection URI
using the "application/x-www-form-urlencoded" format.
access_token (Union[Unset, str]): The issued user access token (for an implicit flow request where
response_type=token). access_token is returned as a parameter in the redirection URI using the
"application/x-www-form-urlencoded" format.
token_type (Union[Unset, str]): The type of the token issued (for an implicit flow request where
response_type=token). token_type is returned as a parameter in the redirection URI using the "application/x-www-
form-urlencoded" format.
expires_in (Union[Unset, str]): The lifetime in seconds of the access token (for an implicit flow request where
response_type=token). For example, the value "3600" denotes that the access token will expire in one hour from
the time the response was generated. expires_in is returned as a parameter in the redirection URI using the
"application/x-www-form-urlencoded" format.
scope (Union[Unset, str]): The scope of the resources authenticated by the authorization server (for an implicit
flow request where response_type=token). scope is returned as a parameter in the redirection URI using the
"application/x-www-form-urlencoded" format.
"""
code: Union[Unset, str] = UNSET
environment: Union[Unset, str] = UNSET
agency_name: Union[Unset, str] = UNSET
state: Union[Unset, str] = UNSET
access_token: Union[Unset, str] = UNSET
token_type: Union[Unset, str] = UNSET
expires_in: Union[Unset, str] = UNSET
scope: Union[Unset, str] = UNSET
additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
code = self.code
environment = self.environment
agency_name = self.agency_name
state = self.state
access_token = self.access_token
token_type = self.token_type
expires_in = self.expires_in
scope = self.scope
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if code is not UNSET:
field_dict["code"] = code
if environment is not UNSET:
field_dict["environment"] = environment
if agency_name is not UNSET:
field_dict["agency_name"] = agency_name
if state is not UNSET:
field_dict["state"] = state
if access_token is not UNSET:
field_dict["access_token"] = access_token
if token_type is not UNSET:
field_dict["token_type"] = token_type
if expires_in is not UNSET:
field_dict["expires_in"] = expires_in
if scope is not UNSET:
field_dict["scope"] = scope
return field_dict
@classmethod
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
d = src_dict.copy()
code = d.pop("code", UNSET)
environment = d.pop("environment", UNSET)
agency_name = d.pop("agency_name", UNSET)
state = d.pop("state", UNSET)
access_token = d.pop("access_token", UNSET)
token_type = d.pop("token_type", UNSET)
expires_in = d.pop("expires_in", UNSET)
scope = d.pop("scope", UNSET)
response_authorize = cls(
code=code,
environment=environment,
agency_name=agency_name,
state=state,
access_token=access_token,
token_type=token_type,
expires_in=expires_in,
scope=scope,
)
response_authorize.additional_properties = d
return response_authorize
@property
def additional_keys(self) -> List[str]:
return list(self.additional_properties.keys())
def __getitem__(self, key: str) -> Any:
return self.additional_properties[key]
def __setitem__(self, key: str, value: Any) -> None:
self.additional_properties[key] = value
def __delitem__(self, key: str) -> None:
del self.additional_properties[key]
def __contains__(self, key: str) -> bool:
return key in self.additional_properties

View file

@ -0,0 +1,83 @@
from typing import Any, Dict, List, Type, TypeVar, Union
from attrs import define as _attrs_define
from attrs import field as _attrs_field
from ..types import UNSET, Unset
T = TypeVar("T", bound="ResponseError")
@_attrs_define
class ResponseError:
"""
Attributes:
error (Union[Unset, str]): The error code. Refer [here](https://tools.ietf.org/html/rfc6749#section-4.1.2) for
details.
error_description (Union[Unset, str]): The error description text.
error_uri (Union[Unset, str]): The URI of web page with more information about the error.
state (Union[Unset, str]): The exact value received from the client.
"""
error: Union[Unset, str] = UNSET
error_description: Union[Unset, str] = UNSET
error_uri: Union[Unset, str] = UNSET
state: Union[Unset, str] = UNSET
additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
error = self.error
error_description = self.error_description
error_uri = self.error_uri
state = self.state
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if error is not UNSET:
field_dict["error"] = error
if error_description is not UNSET:
field_dict["error_description"] = error_description
if error_uri is not UNSET:
field_dict["error_uri"] = error_uri
if state is not UNSET:
field_dict["state"] = state
return field_dict
@classmethod
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
d = src_dict.copy()
error = d.pop("error", UNSET)
error_description = d.pop("error_description", UNSET)
error_uri = d.pop("error_uri", UNSET)
state = d.pop("state", UNSET)
response_error = cls(
error=error,
error_description=error_description,
error_uri=error_uri,
state=state,
)
response_error.additional_properties = d
return response_error
@property
def additional_keys(self) -> List[str]:
return list(self.additional_properties.keys())
def __getitem__(self, key: str) -> Any:
return self.additional_properties[key]
def __setitem__(self, key: str, value: Any) -> None:
self.additional_properties[key] = value
def __delitem__(self, key: str) -> None:
del self.additional_properties[key]
def __contains__(self, key: str) -> bool:
return key in self.additional_properties

View file

@ -0,0 +1,82 @@
from typing import Any, Dict, List, Type, TypeVar, Union
from attrs import define as _attrs_define
from attrs import field as _attrs_field
from ..types import UNSET, Unset
T = TypeVar("T", bound="ResponseStatus")
@_attrs_define
class ResponseStatus:
"""
Attributes:
status (Union[Unset, str]): The HTTP error code.
code (Union[Unset, str]): The error code.
message (Union[Unset, str]): The error message.
trace_id (Union[Unset, str]): The traceid for debugging purposes.
"""
status: Union[Unset, str] = UNSET
code: Union[Unset, str] = UNSET
message: Union[Unset, str] = UNSET
trace_id: Union[Unset, str] = UNSET
additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
status = self.status
code = self.code
message = self.message
trace_id = self.trace_id
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if status is not UNSET:
field_dict["status"] = status
if code is not UNSET:
field_dict["code"] = code
if message is not UNSET:
field_dict["message"] = message
if trace_id is not UNSET:
field_dict["traceId"] = trace_id
return field_dict
@classmethod
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
d = src_dict.copy()
status = d.pop("status", UNSET)
code = d.pop("code", UNSET)
message = d.pop("message", UNSET)
trace_id = d.pop("traceId", UNSET)
response_status = cls(
status=status,
code=code,
message=message,
trace_id=trace_id,
)
response_status.additional_properties = d
return response_status
@property
def additional_keys(self) -> List[str]:
return list(self.additional_properties.keys())
def __getitem__(self, key: str) -> Any:
return self.additional_properties[key]
def __setitem__(self, key: str, value: Any) -> None:
self.additional_properties[key] = value
def __delitem__(self, key: str) -> None:
del self.additional_properties[key]
def __contains__(self, key: str) -> bool:
return key in self.additional_properties

View file

@ -0,0 +1,100 @@
from typing import Any, Dict, List, Type, TypeVar, Union
from attrs import define as _attrs_define
from attrs import field as _attrs_field
from ..types import UNSET, Unset
T = TypeVar("T", bound="ResponseToken")
@_attrs_define
class ResponseToken:
"""
Attributes:
access_token (Union[Unset, str]): The issued user access token.
token_type (Union[Unset, str]): The type of the token issued. It contains the fixed value "bearer" for
authorization_code grant type.
expires_in (Union[Unset, str]): The lifetime in seconds of the access token. For example, the value "3600"
denotes that the access token will expire in one hour from the time the response was generated.
refresh_token (Union[Unset, str]): The refresh token that can be used to obtain a new access token.
scope (Union[Unset, str]): The scope of the resources authenticated by the authorization server.
state (Union[Unset, str]): The exact value received from the client.
"""
access_token: Union[Unset, str] = UNSET
token_type: Union[Unset, str] = UNSET
expires_in: Union[Unset, str] = UNSET
refresh_token: Union[Unset, str] = UNSET
scope: Union[Unset, str] = UNSET
state: Union[Unset, str] = UNSET
additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
access_token = self.access_token
token_type = self.token_type
expires_in = self.expires_in
refresh_token = self.refresh_token
scope = self.scope
state = self.state
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if access_token is not UNSET:
field_dict["access_token"] = access_token
if token_type is not UNSET:
field_dict["token_type"] = token_type
if expires_in is not UNSET:
field_dict["expires_in"] = expires_in
if refresh_token is not UNSET:
field_dict["refresh_token"] = refresh_token
if scope is not UNSET:
field_dict["scope"] = scope
if state is not UNSET:
field_dict["state"] = state
return field_dict
@classmethod
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
d = src_dict.copy()
access_token = d.pop("access_token", UNSET)
token_type = d.pop("token_type", UNSET)
expires_in = d.pop("expires_in", UNSET)
refresh_token = d.pop("refresh_token", UNSET)
scope = d.pop("scope", UNSET)
state = d.pop("state", UNSET)
response_token = cls(
access_token=access_token,
token_type=token_type,
expires_in=expires_in,
refresh_token=refresh_token,
scope=scope,
state=state,
)
response_token.additional_properties = d
return response_token
@property
def additional_keys(self) -> List[str]:
return list(self.additional_properties.keys())
def __getitem__(self, key: str) -> Any:
return self.additional_properties[key]
def __setitem__(self, key: str, value: Any) -> None:
self.additional_properties[key] = value
def __delitem__(self, key: str) -> None:
del self.additional_properties[key]
def __contains__(self, key: str) -> bool:
return key in self.additional_properties

View file

@ -0,0 +1,103 @@
from typing import Any, Dict, List, Type, TypeVar, Union, cast
from attrs import define as _attrs_define
from attrs import field as _attrs_field
from ..types import UNSET, Unset
T = TypeVar("T", bound="ResponseTokeninfo")
@_attrs_define
class ResponseTokeninfo:
"""
Attributes:
app_id (Union[Unset, str]): The app ID value from [Construct Developer Portal](https://developer.accela.com).
This value is passed in your access token request.
user_id (Union[Unset, str]): The logged in user's unique id.
agency_name (Union[Unset, str]): The agency name defined in the Accela Administrator Portal. The agency name is
passed by client request or chosen by the end-user during access token request flow.
scopes (Union[Unset, List[str]]):
expires_in (Union[Unset, int]): The lifetime in seconds of the access token.
state (Union[Unset, str]): The exact value received from the client.
"""
app_id: Union[Unset, str] = UNSET
user_id: Union[Unset, str] = UNSET
agency_name: Union[Unset, str] = UNSET
scopes: Union[Unset, List[str]] = UNSET
expires_in: Union[Unset, int] = UNSET
state: Union[Unset, str] = UNSET
additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
app_id = self.app_id
user_id = self.user_id
agency_name = self.agency_name
scopes: Union[Unset, List[str]] = UNSET
if not isinstance(self.scopes, Unset):
scopes = self.scopes
expires_in = self.expires_in
state = self.state
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if app_id is not UNSET:
field_dict["appId"] = app_id
if user_id is not UNSET:
field_dict["userId"] = user_id
if agency_name is not UNSET:
field_dict["agencyName"] = agency_name
if scopes is not UNSET:
field_dict["scopes"] = scopes
if expires_in is not UNSET:
field_dict["expiresIn"] = expires_in
if state is not UNSET:
field_dict["state"] = state
return field_dict
@classmethod
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
d = src_dict.copy()
app_id = d.pop("appId", UNSET)
user_id = d.pop("userId", UNSET)
agency_name = d.pop("agencyName", UNSET)
scopes = cast(List[str], d.pop("scopes", UNSET))
expires_in = d.pop("expiresIn", UNSET)
state = d.pop("state", UNSET)
response_tokeninfo = cls(
app_id=app_id,
user_id=user_id,
agency_name=agency_name,
scopes=scopes,
expires_in=expires_in,
state=state,
)
response_tokeninfo.additional_properties = d
return response_tokeninfo
@property
def additional_keys(self) -> List[str]:
return list(self.additional_properties.keys())
def __getitem__(self, key: str) -> Any:
return self.additional_properties[key]
def __setitem__(self, key: str, value: Any) -> None:
self.additional_properties[key] = value
def __delitem__(self, key: str) -> None:
del self.additional_properties[key]
def __contains__(self, key: str) -> bool:
return key in self.additional_properties

View file

@ -0,0 +1 @@
# Marker file for PEP 561

View file

@ -0,0 +1,44 @@
""" Contains some shared types for properties """
from http import HTTPStatus
from typing import BinaryIO, Generic, Literal, MutableMapping, Optional, Tuple, TypeVar
from attrs import define
class Unset:
def __bool__(self) -> Literal[False]:
return False
UNSET: Unset = Unset()
FileJsonType = Tuple[Optional[str], BinaryIO, Optional[str]]
@define
class File:
"""Contains information for file uploads"""
payload: BinaryIO
file_name: Optional[str] = None
mime_type: Optional[str] = None
def to_tuple(self) -> FileJsonType:
"""Return a tuple representation that httpx will accept for multipart/form-data"""
return self.file_name, self.payload, self.mime_type
T = TypeVar("T")
@define
class Response(Generic[T]):
"""A response from an endpoint"""
status_code: HTTPStatus
content: bytes
headers: MutableMapping[str, str]
parsed: Optional[T]
__all__ = ["File", "Response", "FileJsonType"]

View file

@ -0,0 +1,24 @@
from .authentication_client import Client as AuthenticationClient
from .records_client import Client as RecordsClient
from .records_client.api.records import v4_get_records
from .create_get_headers import CreateGetHeaders
from .payload import Payload
class AccelaClient:
def __init__(self,
payload: Payload,
url='https://apis.accela.com/'):
self.url = url
self.payload = payload
self.create_get_headers = CreateGetHeaders(payload.to_payload_str())
self._authentication_client = AuthenticationClient(base_url = url)
self._records_client = RecordsClient(base_url=url)
self.v4_get_records = v4_get_records
@property
def authentication_client(self):
return self._authentication_client.with_headers(self.create_get_headers.get_header())
@property
def records_client(self):
return self._records_client.with_headers(self.create_get_headers.get_header())

View file

@ -0,0 +1,57 @@
import json
from datetime import timedelta, datetime
import requests
class Token(object):
def __init__(self, data):
self.__dict__ = json.loads(data)
class CreateGetHeadersToken(Exception):
pass
class CreateGetHeaders:
def __init__(self, payload):
self.payload = payload
self.header = {
"Content-Type": "application/x-www-form-urlencoded"
}
self.expires = 0
self.session_datetime_now = datetime.now()
def is_time_expired(self):
# Get the current time
now = datetime.now()
# Create a timedelta object representing the given time duration
time_difference = timedelta(seconds=self.expires)
# Calculate the future time by adding the time difference to the current time
future_time = self.session_datetime_now + time_difference
return now > future_time
def get_header(self):
if 'Authorization' not in self.header:
self.header['Authorization'] = self.create_token_by_scope()
if self.is_time_expired():
self.header['Authorization'] = self.create_token_by_scope()
return self.header
def create_token_by_scope(self):
reqUrl = "https://apis.accela.com/oauth2/token"
# TODO: Break this down into parts instead of throwing all this into one string.
response = requests.request("POST", reqUrl, data=self.payload, headers=self.header)
if response.status_code == 200:
result_dict = response.json()
self.expires = int(result_dict['expires_in'])
token = Token(response.text.encode('utf8'))
self.session_datetime_now = datetime.now()
return str(token.access_token)
else:
raise CreateGetHeadersToken('Cannot find access token, check your payload.')

View file

@ -0,0 +1,62 @@
import urllib.parse
class Payload:
def __init__(self, grant_type=None, client_id=None, client_secret=None, username=None, password=None, scope=None, agency_name=None, environment=None, payload_str=None):
if payload_str:
# Parse the payload string and set attributes
self._parse_payload_string(payload_str)
else:
# Set attributes directly from parameters
self.grant_type = grant_type
self.client_id = client_id
self.client_secret = client_secret
self.username = username
self.password = password
self.scope = scope
self.agency_name = agency_name
self.environment = environment
# Validate all fields to ensure no None values
self._validate_fields()
def _parse_payload_string(self, payload_str):
# Parse the URL-encoded string into a dictionary
parsed_data = urllib.parse.parse_qs(payload_str)
# Set each attribute, handling list values from parse_qs
self.grant_type = parsed_data.get('grant_type', [None])[0]
self.client_id = parsed_data.get('client_id', [None])[0]
self.client_secret = parsed_data.get('client_secret', [None])[0]
self.username = parsed_data.get('username', [None])[0]
self.password = parsed_data.get('password', [None])[0]
self.scope = parsed_data.get('scope', [None])[0]
self.agency_name = parsed_data.get('agency_name', [None])[0]
self.environment = parsed_data.get('environment', [None])[0]
def _validate_fields(self):
# Check if any attribute is None
missing_fields = [field for field, value in self.__dict__.items() if value is None]
if missing_fields:
raise ValueError(f"Missing required fields: {', '.join(missing_fields)}")
def to_payload_str(self):
# Convert the attributes back into a URL-encoded string
payload_dict = {
'grant_type': self.grant_type,
'client_id': self.client_id,
'client_secret': self.client_secret,
'username': self.username,
'password': self.password,
'scope': self.scope,
'agency_name': self.agency_name,
'environment': self.environment
}
# Return the URL-encoded string
return urllib.parse.urlencode(payload_dict)
def __repr__(self):
# For easy inspection of object attributes
return (f"Payload(grant_type='{self.grant_type}', client_id='{self.client_id}', "
f"client_secret='{self.client_secret}', username='{self.username}', "
f"password='{self.password}', scope='{self.scope}', "
f"agency_name='{self.agency_name}', environment='{self.environment}')")

View file

@ -0,0 +1,7 @@
""" A client library for accessing Records """
from .client import AuthenticatedClient, Client
__all__ = (
"AuthenticatedClient",
"Client",
)

View file

@ -0,0 +1 @@
""" Contains methods for accessing the API """

View file

@ -0,0 +1,156 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...types import UNSET, Response, Unset
def _get_kwargs(
ids: str,
*,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Dict[str, Any]:
headers = {}
headers["Authorization"] = authorization
params: Dict[str, Any] = {}
params["lang"] = lang
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return {
"method": "delete",
"url": "/v4/records/{ids}".format(
ids=ids,
),
"params": params,
"headers": headers,
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if response.status_code == HTTPStatus.BAD_REQUEST:
return None
if response.status_code == HTTPStatus.UNAUTHORIZED:
return None
if response.status_code == HTTPStatus.FORBIDDEN:
return None
if response.status_code == HTTPStatus.NOT_FOUND:
return None
if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
return None
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
ids: str,
*,
client: Union[AuthenticatedClient, Client],
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Delete Records
Deletes the specified record.
**API Endpoint**: DELETE /v4/records/{ids}
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.3
Args:
ids (str):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
ids=ids,
lang=lang,
authorization=authorization,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
ids: str,
*,
client: Union[AuthenticatedClient, Client],
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Delete Records
Deletes the specified record.
**API Endpoint**: DELETE /v4/records/{ids}
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.3
Args:
ids (str):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
ids=ids,
lang=lang,
authorization=authorization,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)

View file

@ -0,0 +1,354 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...types import UNSET, Response, Unset
def _get_kwargs(
*,
type: Union[Unset, None, str] = UNSET,
opened_date_from: Union[Unset, None, str] = UNSET,
opened_date_to: Union[Unset, None, str] = UNSET,
custom_id: Union[Unset, None, str] = UNSET,
module: Union[Unset, None, str] = UNSET,
status: Union[Unset, None, str] = UNSET,
assigned_to_department: Union[Unset, None, str] = UNSET,
assigned_user: Union[Unset, None, str] = UNSET,
assigned_date_from: Union[Unset, None, str] = UNSET,
assigned_date_to: Union[Unset, None, str] = UNSET,
completed_date_from: Union[Unset, None, str] = UNSET,
completed_date_to: Union[Unset, None, str] = UNSET,
status_date_from: Union[Unset, None, str] = UNSET,
status_date_to: Union[Unset, None, str] = UNSET,
completed_by_department: Union[Unset, None, str] = UNSET,
completed_by_user: Union[Unset, None, str] = UNSET,
closed_date_from: Union[Unset, None, str] = UNSET,
closed_date_to: Union[Unset, None, str] = UNSET,
closed_by_department: Union[Unset, None, str] = UNSET,
closed_by_user: Union[Unset, None, str] = UNSET,
record_class: Union[Unset, None, str] = UNSET,
limit: Union[Unset, None, int] = UNSET,
offset: Union[Unset, None, int] = UNSET,
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
) -> Dict[str, Any]:
pass
params: Dict[str, Any] = {}
params["type"] = type
params["openedDateFrom"] = opened_date_from
params["openedDateTo"] = opened_date_to
params["customId"] = custom_id
params["module"] = module
params["status"] = status
params["assignedToDepartment"] = assigned_to_department
params["assignedUser"] = assigned_user
params["assignedDateFrom"] = assigned_date_from
params["assignedDateTo"] = assigned_date_to
params["completedDateFrom"] = completed_date_from
params["completedDateTo"] = completed_date_to
params["statusDateFrom"] = status_date_from
params["statusDateTo"] = status_date_to
params["completedByDepartment"] = completed_by_department
params["completedByUser"] = completed_by_user
params["closedDateFrom"] = closed_date_from
params["closedDateTo"] = closed_date_to
params["closedByDepartment"] = closed_by_department
params["closedByUser"] = closed_by_user
params["recordClass"] = record_class
params["limit"] = limit
params["offset"] = offset
params["fields"] = fields
params["lang"] = lang
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return {
"method": "get",
"url": "/v4/records",
"params": params,
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if response.status_code == HTTPStatus.BAD_REQUEST:
return None
if response.status_code == HTTPStatus.UNAUTHORIZED:
return None
if response.status_code == HTTPStatus.FORBIDDEN:
return None
if response.status_code == HTTPStatus.NOT_FOUND:
return None
if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
return None
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
*,
client: Union[AuthenticatedClient, Client],
type: Union[Unset, None, str] = UNSET,
opened_date_from: Union[Unset, None, str] = UNSET,
opened_date_to: Union[Unset, None, str] = UNSET,
custom_id: Union[Unset, None, str] = UNSET,
module: Union[Unset, None, str] = UNSET,
status: Union[Unset, None, str] = UNSET,
assigned_to_department: Union[Unset, None, str] = UNSET,
assigned_user: Union[Unset, None, str] = UNSET,
assigned_date_from: Union[Unset, None, str] = UNSET,
assigned_date_to: Union[Unset, None, str] = UNSET,
completed_date_from: Union[Unset, None, str] = UNSET,
completed_date_to: Union[Unset, None, str] = UNSET,
status_date_from: Union[Unset, None, str] = UNSET,
status_date_to: Union[Unset, None, str] = UNSET,
completed_by_department: Union[Unset, None, str] = UNSET,
completed_by_user: Union[Unset, None, str] = UNSET,
closed_date_from: Union[Unset, None, str] = UNSET,
closed_date_to: Union[Unset, None, str] = UNSET,
closed_by_department: Union[Unset, None, str] = UNSET,
closed_by_user: Union[Unset, None, str] = UNSET,
record_class: Union[Unset, None, str] = UNSET,
limit: Union[Unset, None, int] = UNSET,
offset: Union[Unset, None, int] = UNSET,
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
) -> Response[Any]:
"""Get All Records
Gets record information, based on the specified query parameters.
**API Endpoint**: GET /v4/records
**Scope**: records
**App Type**: All
**Authorization Type**: No authorization required
**Civic Platform version**: 7.3.2
Args:
type (Union[Unset, None, str]):
opened_date_from (Union[Unset, None, str]):
opened_date_to (Union[Unset, None, str]):
custom_id (Union[Unset, None, str]):
module (Union[Unset, None, str]):
status (Union[Unset, None, str]):
assigned_to_department (Union[Unset, None, str]):
assigned_user (Union[Unset, None, str]):
assigned_date_from (Union[Unset, None, str]):
assigned_date_to (Union[Unset, None, str]):
completed_date_from (Union[Unset, None, str]):
completed_date_to (Union[Unset, None, str]):
status_date_from (Union[Unset, None, str]):
status_date_to (Union[Unset, None, str]):
completed_by_department (Union[Unset, None, str]):
completed_by_user (Union[Unset, None, str]):
closed_date_from (Union[Unset, None, str]):
closed_date_to (Union[Unset, None, str]):
closed_by_department (Union[Unset, None, str]):
closed_by_user (Union[Unset, None, str]):
record_class (Union[Unset, None, str]):
limit (Union[Unset, None, int]):
offset (Union[Unset, None, int]):
fields (Union[Unset, None, str]):
lang (Union[Unset, None, str]):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
type=type,
opened_date_from=opened_date_from,
opened_date_to=opened_date_to,
custom_id=custom_id,
module=module,
status=status,
assigned_to_department=assigned_to_department,
assigned_user=assigned_user,
assigned_date_from=assigned_date_from,
assigned_date_to=assigned_date_to,
completed_date_from=completed_date_from,
completed_date_to=completed_date_to,
status_date_from=status_date_from,
status_date_to=status_date_to,
completed_by_department=completed_by_department,
completed_by_user=completed_by_user,
closed_date_from=closed_date_from,
closed_date_to=closed_date_to,
closed_by_department=closed_by_department,
closed_by_user=closed_by_user,
record_class=record_class,
limit=limit,
offset=offset,
fields=fields,
lang=lang,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
*,
client: Union[AuthenticatedClient, Client],
type: Union[Unset, None, str] = UNSET,
opened_date_from: Union[Unset, None, str] = UNSET,
opened_date_to: Union[Unset, None, str] = UNSET,
custom_id: Union[Unset, None, str] = UNSET,
module: Union[Unset, None, str] = UNSET,
status: Union[Unset, None, str] = UNSET,
assigned_to_department: Union[Unset, None, str] = UNSET,
assigned_user: Union[Unset, None, str] = UNSET,
assigned_date_from: Union[Unset, None, str] = UNSET,
assigned_date_to: Union[Unset, None, str] = UNSET,
completed_date_from: Union[Unset, None, str] = UNSET,
completed_date_to: Union[Unset, None, str] = UNSET,
status_date_from: Union[Unset, None, str] = UNSET,
status_date_to: Union[Unset, None, str] = UNSET,
completed_by_department: Union[Unset, None, str] = UNSET,
completed_by_user: Union[Unset, None, str] = UNSET,
closed_date_from: Union[Unset, None, str] = UNSET,
closed_date_to: Union[Unset, None, str] = UNSET,
closed_by_department: Union[Unset, None, str] = UNSET,
closed_by_user: Union[Unset, None, str] = UNSET,
record_class: Union[Unset, None, str] = UNSET,
limit: Union[Unset, None, int] = UNSET,
offset: Union[Unset, None, int] = UNSET,
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
) -> Response[Any]:
"""Get All Records
Gets record information, based on the specified query parameters.
**API Endpoint**: GET /v4/records
**Scope**: records
**App Type**: All
**Authorization Type**: No authorization required
**Civic Platform version**: 7.3.2
Args:
type (Union[Unset, None, str]):
opened_date_from (Union[Unset, None, str]):
opened_date_to (Union[Unset, None, str]):
custom_id (Union[Unset, None, str]):
module (Union[Unset, None, str]):
status (Union[Unset, None, str]):
assigned_to_department (Union[Unset, None, str]):
assigned_user (Union[Unset, None, str]):
assigned_date_from (Union[Unset, None, str]):
assigned_date_to (Union[Unset, None, str]):
completed_date_from (Union[Unset, None, str]):
completed_date_to (Union[Unset, None, str]):
status_date_from (Union[Unset, None, str]):
status_date_to (Union[Unset, None, str]):
completed_by_department (Union[Unset, None, str]):
completed_by_user (Union[Unset, None, str]):
closed_date_from (Union[Unset, None, str]):
closed_date_to (Union[Unset, None, str]):
closed_by_department (Union[Unset, None, str]):
closed_by_user (Union[Unset, None, str]):
record_class (Union[Unset, None, str]):
limit (Union[Unset, None, int]):
offset (Union[Unset, None, int]):
fields (Union[Unset, None, str]):
lang (Union[Unset, None, str]):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
type=type,
opened_date_from=opened_date_from,
opened_date_to=opened_date_to,
custom_id=custom_id,
module=module,
status=status,
assigned_to_department=assigned_to_department,
assigned_user=assigned_user,
assigned_date_from=assigned_date_from,
assigned_date_to=assigned_date_to,
completed_date_from=completed_date_from,
completed_date_to=completed_date_to,
status_date_from=status_date_from,
status_date_to=status_date_to,
completed_by_department=completed_by_department,
completed_by_user=completed_by_user,
closed_date_from=closed_date_from,
closed_date_to=closed_date_to,
closed_by_department=closed_by_department,
closed_by_user=closed_by_user,
record_class=record_class,
limit=limit,
offset=offset,
fields=fields,
lang=lang,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)

View file

@ -0,0 +1,156 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...types import UNSET, Response, Unset
def _get_kwargs(
*,
type: str,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Dict[str, Any]:
headers = {}
headers["Authorization"] = authorization
params: Dict[str, Any] = {}
params["type"] = type
params["lang"] = lang
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return {
"method": "get",
"url": "/v4/records/describe/create",
"params": params,
"headers": headers,
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if response.status_code == HTTPStatus.BAD_REQUEST:
return None
if response.status_code == HTTPStatus.UNAUTHORIZED:
return None
if response.status_code == HTTPStatus.FORBIDDEN:
return None
if response.status_code == HTTPStatus.NOT_FOUND:
return None
if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
return None
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
*,
client: Union[AuthenticatedClient, Client],
type: str,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Describe Required Record Attributes
Gets the field and element values the system requires in order to create a specific type of record.
**API Endpoint**: GET /v4/records/describe/create
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
type (str):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
type=type,
lang=lang,
authorization=authorization,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
*,
client: Union[AuthenticatedClient, Client],
type: str,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Describe Required Record Attributes
Gets the field and element values the system requires in order to create a specific type of record.
**API Endpoint**: GET /v4/records/describe/create
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
type (str):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
type=type,
lang=lang,
authorization=authorization,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)

View file

@ -0,0 +1,184 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...models.v4_get_records_ids_expand import V4GetRecordsIdsExpand
from ...models.v4_get_records_ids_expand_custom_forms import V4GetRecordsIdsExpandCustomForms
from ...types import UNSET, Response, Unset
def _get_kwargs(
ids: str,
*,
expand: Union[Unset, None, V4GetRecordsIdsExpand] = UNSET,
expand_custom_forms: Union[Unset, None, V4GetRecordsIdsExpandCustomForms] = UNSET,
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
) -> Dict[str, Any]:
pass
params: Dict[str, Any] = {}
json_expand: Union[Unset, None, str] = UNSET
if not isinstance(expand, Unset):
json_expand = expand.value if expand else None
params["expand"] = json_expand
json_expand_custom_forms: Union[Unset, None, str] = UNSET
if not isinstance(expand_custom_forms, Unset):
json_expand_custom_forms = expand_custom_forms.value if expand_custom_forms else None
params["expandCustomForms"] = json_expand_custom_forms
params["fields"] = fields
params["lang"] = lang
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return {
"method": "get",
"url": "/v4/records/{ids}".format(
ids=ids,
),
"params": params,
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if response.status_code == HTTPStatus.BAD_REQUEST:
return None
if response.status_code == HTTPStatus.UNAUTHORIZED:
return None
if response.status_code == HTTPStatus.FORBIDDEN:
return None
if response.status_code == HTTPStatus.NOT_FOUND:
return None
if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
return None
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
ids: str,
*,
client: Union[AuthenticatedClient, Client],
expand: Union[Unset, None, V4GetRecordsIdsExpand] = UNSET,
expand_custom_forms: Union[Unset, None, V4GetRecordsIdsExpandCustomForms] = UNSET,
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
) -> Response[Any]:
"""Get Records
Gets the requested record(s).
**API Endpoint**: GET /v4/records/{ids}
**Scope**: records
**App Type**: All
**Authorization Type**: No authorization required
**Civic Platform version**: 7.3.2
Args:
ids (str):
expand (Union[Unset, None, V4GetRecordsIdsExpand]):
expand_custom_forms (Union[Unset, None, V4GetRecordsIdsExpandCustomForms]):
fields (Union[Unset, None, str]):
lang (Union[Unset, None, str]):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
ids=ids,
expand=expand,
expand_custom_forms=expand_custom_forms,
fields=fields,
lang=lang,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
ids: str,
*,
client: Union[AuthenticatedClient, Client],
expand: Union[Unset, None, V4GetRecordsIdsExpand] = UNSET,
expand_custom_forms: Union[Unset, None, V4GetRecordsIdsExpandCustomForms] = UNSET,
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
) -> Response[Any]:
"""Get Records
Gets the requested record(s).
**API Endpoint**: GET /v4/records/{ids}
**Scope**: records
**App Type**: All
**Authorization Type**: No authorization required
**Civic Platform version**: 7.3.2
Args:
ids (str):
expand (Union[Unset, None, V4GetRecordsIdsExpand]):
expand_custom_forms (Union[Unset, None, V4GetRecordsIdsExpandCustomForms]):
fields (Union[Unset, None, str]):
lang (Union[Unset, None, str]):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
ids=ids,
expand=expand,
expand_custom_forms=expand_custom_forms,
fields=fields,
lang=lang,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)

View file

@ -0,0 +1,409 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...models.v4_get_records_mine_expand import V4GetRecordsMineExpand
from ...models.v4_get_records_mine_expand_custom_forms import V4GetRecordsMineExpandCustomForms
from ...types import UNSET, Response, Unset
def _get_kwargs(
*,
type: Union[Unset, None, str] = UNSET,
opened_date_from: Union[Unset, None, str] = UNSET,
opened_date_to: Union[Unset, None, str] = UNSET,
custom_id: Union[Unset, None, str] = UNSET,
module: Union[Unset, None, str] = UNSET,
status: Union[Unset, None, str] = UNSET,
assigned_date_from: Union[Unset, None, str] = UNSET,
assigned_date_to: Union[Unset, None, str] = UNSET,
completed_date_from: Union[Unset, None, str] = UNSET,
completed_date_to: Union[Unset, None, str] = UNSET,
status_date_from: Union[Unset, None, str] = UNSET,
status_date_to: Union[Unset, None, str] = UNSET,
update_date_from: Union[Unset, None, str] = UNSET,
update_date_to: Union[Unset, None, str] = UNSET,
completed_by_department: Union[Unset, None, str] = UNSET,
completed_by_user: Union[Unset, None, str] = UNSET,
closed_date_from: Union[Unset, None, str] = UNSET,
closed_date_to: Union[Unset, None, str] = UNSET,
closed_by_department: Union[Unset, None, str] = UNSET,
closed_by_user: Union[Unset, None, str] = UNSET,
record_class: Union[Unset, None, str] = UNSET,
types: Union[Unset, None, str] = UNSET,
modules: Union[Unset, None, str] = UNSET,
status_types: Union[Unset, None, str] = UNSET,
expand: Union[Unset, None, V4GetRecordsMineExpand] = UNSET,
expand_custom_forms: Union[Unset, None, V4GetRecordsMineExpandCustomForms] = UNSET,
limit: Union[Unset, None, int] = UNSET,
offset: Union[Unset, None, int] = UNSET,
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
) -> Dict[str, Any]:
pass
params: Dict[str, Any] = {}
params["type"] = type
params["openedDateFrom"] = opened_date_from
params["openedDateTo"] = opened_date_to
params["customId"] = custom_id
params["module"] = module
params["status"] = status
params["assignedDateFrom"] = assigned_date_from
params["assignedDateTo"] = assigned_date_to
params["completedDateFrom"] = completed_date_from
params["completedDateTo"] = completed_date_to
params["statusDateFrom"] = status_date_from
params["statusDateTo"] = status_date_to
params["updateDateFrom"] = update_date_from
params["updateDateTo"] = update_date_to
params["completedByDepartment"] = completed_by_department
params["completedByUser"] = completed_by_user
params["closedDateFrom"] = closed_date_from
params["closedDateTo"] = closed_date_to
params["closedByDepartment"] = closed_by_department
params["closedByUser"] = closed_by_user
params["recordClass"] = record_class
params["types"] = types
params["modules"] = modules
params["statusTypes"] = status_types
json_expand: Union[Unset, None, str] = UNSET
if not isinstance(expand, Unset):
json_expand = expand.value if expand else None
params["expand"] = json_expand
json_expand_custom_forms: Union[Unset, None, str] = UNSET
if not isinstance(expand_custom_forms, Unset):
json_expand_custom_forms = expand_custom_forms.value if expand_custom_forms else None
params["expandCustomForms"] = json_expand_custom_forms
params["limit"] = limit
params["offset"] = offset
params["fields"] = fields
params["lang"] = lang
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return {
"method": "get",
"url": "/v4/records/mine",
"params": params,
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if response.status_code == HTTPStatus.BAD_REQUEST:
return None
if response.status_code == HTTPStatus.UNAUTHORIZED:
return None
if response.status_code == HTTPStatus.FORBIDDEN:
return None
if response.status_code == HTTPStatus.NOT_FOUND:
return None
if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
return None
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
*,
client: Union[AuthenticatedClient, Client],
type: Union[Unset, None, str] = UNSET,
opened_date_from: Union[Unset, None, str] = UNSET,
opened_date_to: Union[Unset, None, str] = UNSET,
custom_id: Union[Unset, None, str] = UNSET,
module: Union[Unset, None, str] = UNSET,
status: Union[Unset, None, str] = UNSET,
assigned_date_from: Union[Unset, None, str] = UNSET,
assigned_date_to: Union[Unset, None, str] = UNSET,
completed_date_from: Union[Unset, None, str] = UNSET,
completed_date_to: Union[Unset, None, str] = UNSET,
status_date_from: Union[Unset, None, str] = UNSET,
status_date_to: Union[Unset, None, str] = UNSET,
update_date_from: Union[Unset, None, str] = UNSET,
update_date_to: Union[Unset, None, str] = UNSET,
completed_by_department: Union[Unset, None, str] = UNSET,
completed_by_user: Union[Unset, None, str] = UNSET,
closed_date_from: Union[Unset, None, str] = UNSET,
closed_date_to: Union[Unset, None, str] = UNSET,
closed_by_department: Union[Unset, None, str] = UNSET,
closed_by_user: Union[Unset, None, str] = UNSET,
record_class: Union[Unset, None, str] = UNSET,
types: Union[Unset, None, str] = UNSET,
modules: Union[Unset, None, str] = UNSET,
status_types: Union[Unset, None, str] = UNSET,
expand: Union[Unset, None, V4GetRecordsMineExpand] = UNSET,
expand_custom_forms: Union[Unset, None, V4GetRecordsMineExpandCustomForms] = UNSET,
limit: Union[Unset, None, int] = UNSET,
offset: Union[Unset, None, int] = UNSET,
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
) -> Response[Any]:
"""Get My Records
Gets records for the currently logged-in user.
**API Endpoint**: GET /v4/records/mine
**Scope**: records
**App Type**: All
**Authorization Type**: No authorization required
**Civic Platform version**: 7.3.2
Args:
type (Union[Unset, None, str]):
opened_date_from (Union[Unset, None, str]):
opened_date_to (Union[Unset, None, str]):
custom_id (Union[Unset, None, str]):
module (Union[Unset, None, str]):
status (Union[Unset, None, str]):
assigned_date_from (Union[Unset, None, str]):
assigned_date_to (Union[Unset, None, str]):
completed_date_from (Union[Unset, None, str]):
completed_date_to (Union[Unset, None, str]):
status_date_from (Union[Unset, None, str]):
status_date_to (Union[Unset, None, str]):
update_date_from (Union[Unset, None, str]):
update_date_to (Union[Unset, None, str]):
completed_by_department (Union[Unset, None, str]):
completed_by_user (Union[Unset, None, str]):
closed_date_from (Union[Unset, None, str]):
closed_date_to (Union[Unset, None, str]):
closed_by_department (Union[Unset, None, str]):
closed_by_user (Union[Unset, None, str]):
record_class (Union[Unset, None, str]):
types (Union[Unset, None, str]):
modules (Union[Unset, None, str]):
status_types (Union[Unset, None, str]):
expand (Union[Unset, None, V4GetRecordsMineExpand]):
expand_custom_forms (Union[Unset, None, V4GetRecordsMineExpandCustomForms]):
limit (Union[Unset, None, int]):
offset (Union[Unset, None, int]):
fields (Union[Unset, None, str]):
lang (Union[Unset, None, str]):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
type=type,
opened_date_from=opened_date_from,
opened_date_to=opened_date_to,
custom_id=custom_id,
module=module,
status=status,
assigned_date_from=assigned_date_from,
assigned_date_to=assigned_date_to,
completed_date_from=completed_date_from,
completed_date_to=completed_date_to,
status_date_from=status_date_from,
status_date_to=status_date_to,
update_date_from=update_date_from,
update_date_to=update_date_to,
completed_by_department=completed_by_department,
completed_by_user=completed_by_user,
closed_date_from=closed_date_from,
closed_date_to=closed_date_to,
closed_by_department=closed_by_department,
closed_by_user=closed_by_user,
record_class=record_class,
types=types,
modules=modules,
status_types=status_types,
expand=expand,
expand_custom_forms=expand_custom_forms,
limit=limit,
offset=offset,
fields=fields,
lang=lang,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
*,
client: Union[AuthenticatedClient, Client],
type: Union[Unset, None, str] = UNSET,
opened_date_from: Union[Unset, None, str] = UNSET,
opened_date_to: Union[Unset, None, str] = UNSET,
custom_id: Union[Unset, None, str] = UNSET,
module: Union[Unset, None, str] = UNSET,
status: Union[Unset, None, str] = UNSET,
assigned_date_from: Union[Unset, None, str] = UNSET,
assigned_date_to: Union[Unset, None, str] = UNSET,
completed_date_from: Union[Unset, None, str] = UNSET,
completed_date_to: Union[Unset, None, str] = UNSET,
status_date_from: Union[Unset, None, str] = UNSET,
status_date_to: Union[Unset, None, str] = UNSET,
update_date_from: Union[Unset, None, str] = UNSET,
update_date_to: Union[Unset, None, str] = UNSET,
completed_by_department: Union[Unset, None, str] = UNSET,
completed_by_user: Union[Unset, None, str] = UNSET,
closed_date_from: Union[Unset, None, str] = UNSET,
closed_date_to: Union[Unset, None, str] = UNSET,
closed_by_department: Union[Unset, None, str] = UNSET,
closed_by_user: Union[Unset, None, str] = UNSET,
record_class: Union[Unset, None, str] = UNSET,
types: Union[Unset, None, str] = UNSET,
modules: Union[Unset, None, str] = UNSET,
status_types: Union[Unset, None, str] = UNSET,
expand: Union[Unset, None, V4GetRecordsMineExpand] = UNSET,
expand_custom_forms: Union[Unset, None, V4GetRecordsMineExpandCustomForms] = UNSET,
limit: Union[Unset, None, int] = UNSET,
offset: Union[Unset, None, int] = UNSET,
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
) -> Response[Any]:
"""Get My Records
Gets records for the currently logged-in user.
**API Endpoint**: GET /v4/records/mine
**Scope**: records
**App Type**: All
**Authorization Type**: No authorization required
**Civic Platform version**: 7.3.2
Args:
type (Union[Unset, None, str]):
opened_date_from (Union[Unset, None, str]):
opened_date_to (Union[Unset, None, str]):
custom_id (Union[Unset, None, str]):
module (Union[Unset, None, str]):
status (Union[Unset, None, str]):
assigned_date_from (Union[Unset, None, str]):
assigned_date_to (Union[Unset, None, str]):
completed_date_from (Union[Unset, None, str]):
completed_date_to (Union[Unset, None, str]):
status_date_from (Union[Unset, None, str]):
status_date_to (Union[Unset, None, str]):
update_date_from (Union[Unset, None, str]):
update_date_to (Union[Unset, None, str]):
completed_by_department (Union[Unset, None, str]):
completed_by_user (Union[Unset, None, str]):
closed_date_from (Union[Unset, None, str]):
closed_date_to (Union[Unset, None, str]):
closed_by_department (Union[Unset, None, str]):
closed_by_user (Union[Unset, None, str]):
record_class (Union[Unset, None, str]):
types (Union[Unset, None, str]):
modules (Union[Unset, None, str]):
status_types (Union[Unset, None, str]):
expand (Union[Unset, None, V4GetRecordsMineExpand]):
expand_custom_forms (Union[Unset, None, V4GetRecordsMineExpandCustomForms]):
limit (Union[Unset, None, int]):
offset (Union[Unset, None, int]):
fields (Union[Unset, None, str]):
lang (Union[Unset, None, str]):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
type=type,
opened_date_from=opened_date_from,
opened_date_to=opened_date_to,
custom_id=custom_id,
module=module,
status=status,
assigned_date_from=assigned_date_from,
assigned_date_to=assigned_date_to,
completed_date_from=completed_date_from,
completed_date_to=completed_date_to,
status_date_from=status_date_from,
status_date_to=status_date_to,
update_date_from=update_date_from,
update_date_to=update_date_to,
completed_by_department=completed_by_department,
completed_by_user=completed_by_user,
closed_date_from=closed_date_from,
closed_date_to=closed_date_to,
closed_by_department=closed_by_department,
closed_by_user=closed_by_user,
record_class=record_class,
types=types,
modules=modules,
status_types=status_types,
expand=expand,
expand_custom_forms=expand_custom_forms,
limit=limit,
offset=offset,
fields=fields,
lang=lang,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)

View file

@ -0,0 +1,170 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...types import UNSET, Response, Unset
def _get_kwargs(
*,
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
record_data: {}
) -> Dict[str, Any]:
headers = {}
headers["Authorization"] = authorization
params: Dict[str, Any] = {}
params["fields"] = fields
params["lang"] = lang
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return {
"method": "post",
"url": "/v4/records",
"params": params,
"headers": headers,
"data": record_data
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if response.status_code == HTTPStatus.BAD_REQUEST:
return None
if response.status_code == HTTPStatus.UNAUTHORIZED:
return None
if response.status_code == HTTPStatus.FORBIDDEN:
return None
if response.status_code == HTTPStatus.NOT_FOUND:
return None
if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
return None
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
*,
client: Union[AuthenticatedClient, Client],
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Create Record
Creates a new, full record in Civic Platform. The Create Record API triggers the business rules
engine event ApplicationSubmitAfter.
Note: The Create Record API does not include custom forms and custom tables in the request body. To
add or update custom forms and custom tables, use the [Update Record Custom Forms](./api-
records.html#operation/v4.put.records.recordId.customForms) and [Update Record Custom Tables](./api-
records.html#operation/v4.put.records.recordId.customForms) after the Create Record request.
**API Endpoint**: POST /v4/records
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
fields (Union[Unset, None, str]):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
fields=fields,
lang=lang,
authorization=authorization,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
*,
client: Union[AuthenticatedClient, Client],
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Create Record
Creates a new, full record in Civic Platform. The Create Record API triggers the business rules
engine event ApplicationSubmitAfter.
Note: The Create Record API does not include custom forms and custom tables in the request body. To
add or update custom forms and custom tables, use the [Update Record Custom Forms](./api-
records.html#operation/v4.put.records.recordId.customForms) and [Update Record Custom Tables](./api-
records.html#operation/v4.put.records.recordId.customForms) after the Create Record request.
**API Endpoint**: POST /v4/records
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
fields (Union[Unset, None, str]):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
fields=fields,
lang=lang,
authorization=authorization,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)

View file

@ -0,0 +1,165 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...types import UNSET, Response, Unset
def _get_kwargs(
ids: str,
*,
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Dict[str, Any]:
headers = {}
headers["Authorization"] = authorization
params: Dict[str, Any] = {}
params["fields"] = fields
params["lang"] = lang
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return {
"method": "put",
"url": "/v4/records/{ids}".format(
ids=ids,
),
"params": params,
"headers": headers,
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if response.status_code == HTTPStatus.BAD_REQUEST:
return None
if response.status_code == HTTPStatus.UNAUTHORIZED:
return None
if response.status_code == HTTPStatus.FORBIDDEN:
return None
if response.status_code == HTTPStatus.NOT_FOUND:
return None
if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
return None
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
ids: str,
*,
client: Union[AuthenticatedClient, Client],
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Update Record
Updates details for the specified record.
**API Endpoint**: PUT /v4/records/{id}
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
ids (str):
fields (Union[Unset, None, str]):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
ids=ids,
fields=fields,
lang=lang,
authorization=authorization,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
ids: str,
*,
client: Union[AuthenticatedClient, Client],
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Update Record
Updates details for the specified record.
**API Endpoint**: PUT /v4/records/{id}
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
ids (str):
fields (Union[Unset, None, str]):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
ids=ids,
fields=fields,
lang=lang,
authorization=authorization,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)

View file

@ -0,0 +1,164 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...types import UNSET, Response, Unset
def _get_kwargs(
record_id: str,
child_record_ids: str,
*,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Dict[str, Any]:
headers = {}
headers["Authorization"] = authorization
params: Dict[str, Any] = {}
params["lang"] = lang
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return {
"method": "delete",
"url": "/v4/records/{recordId}/related/{childRecordIds}".format(
recordId=record_id,
childRecordIds=child_record_ids,
),
"params": params,
"headers": headers,
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if response.status_code == HTTPStatus.BAD_REQUEST:
return None
if response.status_code == HTTPStatus.UNAUTHORIZED:
return None
if response.status_code == HTTPStatus.FORBIDDEN:
return None
if response.status_code == HTTPStatus.NOT_FOUND:
return None
if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
return None
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
record_id: str,
child_record_ids: str,
*,
client: Union[AuthenticatedClient, Client],
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Delete Related Details from Record
Removes the relationship between the specifed child record(s) and their specified parent record.
**API Endpoint**: DELETE /v4/records/{recordId}/related/{childRecordIds}
**Scope**: records
**App Type**: Agency
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
child_record_ids (str):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
child_record_ids=child_record_ids,
lang=lang,
authorization=authorization,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
record_id: str,
child_record_ids: str,
*,
client: Union[AuthenticatedClient, Client],
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Delete Related Details from Record
Removes the relationship between the specifed child record(s) and their specified parent record.
**API Endpoint**: DELETE /v4/records/{recordId}/related/{childRecordIds}
**Scope**: records
**App Type**: Agency
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
child_record_ids (str):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
child_record_ids=child_record_ids,
lang=lang,
authorization=authorization,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)

View file

@ -0,0 +1,165 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...types import UNSET, Response, Unset
def _get_kwargs(
record_id: str,
*,
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Dict[str, Any]:
headers = {}
headers["Authorization"] = authorization
params: Dict[str, Any] = {}
params["fields"] = fields
params["lang"] = lang
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return {
"method": "get",
"url": "/v4/records/{recordId}/additional".format(
recordId=record_id,
),
"params": params,
"headers": headers,
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if response.status_code == HTTPStatus.BAD_REQUEST:
return None
if response.status_code == HTTPStatus.UNAUTHORIZED:
return None
if response.status_code == HTTPStatus.FORBIDDEN:
return None
if response.status_code == HTTPStatus.NOT_FOUND:
return None
if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
return None
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
record_id: str,
*,
client: Union[AuthenticatedClient, Client],
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Get Additional Details for Record
Gets additional information for the requested record.
**API Endpoint**: GET /v4/records/{recordId}/additional
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
fields (Union[Unset, None, str]):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
fields=fields,
lang=lang,
authorization=authorization,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
record_id: str,
*,
client: Union[AuthenticatedClient, Client],
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Get Additional Details for Record
Gets additional information for the requested record.
**API Endpoint**: GET /v4/records/{recordId}/additional
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
fields (Union[Unset, None, str]):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
fields=fields,
lang=lang,
authorization=authorization,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)

View file

@ -0,0 +1,179 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...models.v4_get_records_record_id_related_relationship import V4GetRecordsRecordIdRelatedRelationship
from ...types import UNSET, Response, Unset
def _get_kwargs(
record_id: str,
*,
relationship: Union[Unset, None, V4GetRecordsRecordIdRelatedRelationship] = UNSET,
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Dict[str, Any]:
headers = {}
headers["Authorization"] = authorization
params: Dict[str, Any] = {}
json_relationship: Union[Unset, None, str] = UNSET
if not isinstance(relationship, Unset):
json_relationship = relationship.value if relationship else None
params["relationship"] = json_relationship
params["fields"] = fields
params["lang"] = lang
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return {
"method": "get",
"url": "/v4/records/{recordId}/related".format(
recordId=record_id,
),
"params": params,
"headers": headers,
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if response.status_code == HTTPStatus.BAD_REQUEST:
return None
if response.status_code == HTTPStatus.UNAUTHORIZED:
return None
if response.status_code == HTTPStatus.FORBIDDEN:
return None
if response.status_code == HTTPStatus.NOT_FOUND:
return None
if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
return None
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
record_id: str,
*,
client: Union[AuthenticatedClient, Client],
relationship: Union[Unset, None, V4GetRecordsRecordIdRelatedRelationship] = UNSET,
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Get All Related Details for Record
Gets the records related, by a parent or child relation, to the specified record.
**API Endpoint**: GET /v4/records/{recordId}/related
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
relationship (Union[Unset, None, V4GetRecordsRecordIdRelatedRelationship]):
fields (Union[Unset, None, str]):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
relationship=relationship,
fields=fields,
lang=lang,
authorization=authorization,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
record_id: str,
*,
client: Union[AuthenticatedClient, Client],
relationship: Union[Unset, None, V4GetRecordsRecordIdRelatedRelationship] = UNSET,
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Get All Related Details for Record
Gets the records related, by a parent or child relation, to the specified record.
**API Endpoint**: GET /v4/records/{recordId}/related
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
relationship (Union[Unset, None, V4GetRecordsRecordIdRelatedRelationship]):
fields (Union[Unset, None, str]):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
relationship=relationship,
fields=fields,
lang=lang,
authorization=authorization,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)

View file

@ -0,0 +1,187 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...types import UNSET, Response, Unset
def _get_kwargs(
record_id: str,
*,
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Dict[str, Any]:
headers = {}
headers["Authorization"] = authorization
params: Dict[str, Any] = {}
params["fields"] = fields
params["lang"] = lang
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return {
"method": "post",
"url": "/v4/records/{recordId}/finalize".format(
recordId=record_id,
),
"params": params,
"headers": headers,
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if response.status_code == HTTPStatus.BAD_REQUEST:
return None
if response.status_code == HTTPStatus.UNAUTHORIZED:
return None
if response.status_code == HTTPStatus.FORBIDDEN:
return None
if response.status_code == HTTPStatus.NOT_FOUND:
return None
if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
return None
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
record_id: str,
*,
client: Union[AuthenticatedClient, Client],
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Finalize Record
Creates the finalized record in the database. Use this method after calling Create Partial Record to
submit the completed record. See [Creating Records](https://developer.accela.com/docs/construct-api-
records.html#construct-api-records__creatingRecords) for more information about calling Finalize
Record in tandem with Create Partial Record.
The Create Partial Record API triggers the business rules engine event ApplicationSubmitAfter.
Note: The Finalize Record API does not include custom forms and custom tables in the request body.
To add or update custom forms and custom tables, use the [Update Record Custom Forms](./api-
records.html#operation/v4.put.records.recordId.customForms) and [Update Record Custom Tables](./api-
records.html#operation/v4.put.records.recordId.customForms) between the Create Partial Record and
Finalize Record requests.
**API Endpoint**: POST /v4/records/{recordId}/finalize
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
fields (Union[Unset, None, str]):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
fields=fields,
lang=lang,
authorization=authorization,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
record_id: str,
*,
client: Union[AuthenticatedClient, Client],
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Finalize Record
Creates the finalized record in the database. Use this method after calling Create Partial Record to
submit the completed record. See [Creating Records](https://developer.accela.com/docs/construct-api-
records.html#construct-api-records__creatingRecords) for more information about calling Finalize
Record in tandem with Create Partial Record.
The Create Partial Record API triggers the business rules engine event ApplicationSubmitAfter.
Note: The Finalize Record API does not include custom forms and custom tables in the request body.
To add or update custom forms and custom tables, use the [Update Record Custom Forms](./api-
records.html#operation/v4.put.records.recordId.customForms) and [Update Record Custom Tables](./api-
records.html#operation/v4.put.records.recordId.customForms) between the Create Partial Record and
Finalize Record requests.
**API Endpoint**: POST /v4/records/{recordId}/finalize
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
fields (Union[Unset, None, str]):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
fields=fields,
lang=lang,
authorization=authorization,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)

View file

@ -0,0 +1,156 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...types import UNSET, Response, Unset
def _get_kwargs(
record_id: str,
*,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Dict[str, Any]:
headers = {}
headers["Authorization"] = authorization
params: Dict[str, Any] = {}
params["lang"] = lang
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return {
"method": "post",
"url": "/v4/records/{recordId}/related".format(
recordId=record_id,
),
"params": params,
"headers": headers,
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if response.status_code == HTTPStatus.BAD_REQUEST:
return None
if response.status_code == HTTPStatus.UNAUTHORIZED:
return None
if response.status_code == HTTPStatus.FORBIDDEN:
return None
if response.status_code == HTTPStatus.NOT_FOUND:
return None
if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
return None
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
record_id: str,
*,
client: Union[AuthenticatedClient, Client],
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Create Related Details for Record
Creates a child relationship to the specified (parent) record.
**API Endpoint**: POST /v4/records/{recordId}/related
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
lang=lang,
authorization=authorization,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
record_id: str,
*,
client: Union[AuthenticatedClient, Client],
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Create Related Details for Record
Creates a child relationship to the specified (parent) record.
**API Endpoint**: POST /v4/records/{recordId}/related
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
lang=lang,
authorization=authorization,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)

View file

@ -0,0 +1,165 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...types import UNSET, Response, Unset
def _get_kwargs(
record_id: str,
*,
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Dict[str, Any]:
headers = {}
headers["Authorization"] = authorization
params: Dict[str, Any] = {}
params["fields"] = fields
params["lang"] = lang
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return {
"method": "put",
"url": "/v4/records/{recordId}/additional".format(
recordId=record_id,
),
"params": params,
"headers": headers,
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if response.status_code == HTTPStatus.BAD_REQUEST:
return None
if response.status_code == HTTPStatus.UNAUTHORIZED:
return None
if response.status_code == HTTPStatus.FORBIDDEN:
return None
if response.status_code == HTTPStatus.NOT_FOUND:
return None
if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
return None
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
record_id: str,
*,
client: Union[AuthenticatedClient, Client],
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Update Additional Details for Record
Updates additional information for the specified record.
**API Endpoint**: PUT /v4/records/{recordId}/additional
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
fields (Union[Unset, None, str]):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
fields=fields,
lang=lang,
authorization=authorization,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
record_id: str,
*,
client: Union[AuthenticatedClient, Client],
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Update Additional Details for Record
Updates additional information for the specified record.
**API Endpoint**: PUT /v4/records/{recordId}/additional
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
fields (Union[Unset, None, str]):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
fields=fields,
lang=lang,
authorization=authorization,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)

View file

@ -0,0 +1,165 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...types import UNSET, Response, Unset
def _get_kwargs(
record_id: str,
*,
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Dict[str, Any]:
headers = {}
headers["Authorization"] = authorization
params: Dict[str, Any] = {}
params["fields"] = fields
params["lang"] = lang
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return {
"method": "get",
"url": "/v4/records/{recordId}/activities".format(
recordId=record_id,
),
"params": params,
"headers": headers,
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if response.status_code == HTTPStatus.BAD_REQUEST:
return None
if response.status_code == HTTPStatus.UNAUTHORIZED:
return None
if response.status_code == HTTPStatus.FORBIDDEN:
return None
if response.status_code == HTTPStatus.NOT_FOUND:
return None
if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
return None
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
record_id: str,
*,
client: Union[AuthenticatedClient, Client],
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Get All Record Activities
Gets all activities related to the specified record.
**API Endpoint**: GET /v4/records/{recordId}/activities
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
fields (Union[Unset, None, str]):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
fields=fields,
lang=lang,
authorization=authorization,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
record_id: str,
*,
client: Union[AuthenticatedClient, Client],
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Get All Record Activities
Gets all activities related to the specified record.
**API Endpoint**: GET /v4/records/{recordId}/activities
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
fields (Union[Unset, None, str]):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
fields=fields,
lang=lang,
authorization=authorization,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)

View file

@ -0,0 +1,156 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...types import UNSET, Response, Unset
def _get_kwargs(
record_id: str,
*,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Dict[str, Any]:
headers = {}
headers["Authorization"] = authorization
params: Dict[str, Any] = {}
params["lang"] = lang
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return {
"method": "post",
"url": "/v4/records/{recordId}/activities".format(
recordId=record_id,
),
"params": params,
"headers": headers,
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if response.status_code == HTTPStatus.BAD_REQUEST:
return None
if response.status_code == HTTPStatus.UNAUTHORIZED:
return None
if response.status_code == HTTPStatus.FORBIDDEN:
return None
if response.status_code == HTTPStatus.NOT_FOUND:
return None
if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
return None
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
record_id: str,
*,
client: Union[AuthenticatedClient, Client],
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Create Record Activities
Creates activities associated to the specified record.
**API Endpoint**: POST /v4/records/{recordId}/activities
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.3.2
Args:
record_id (str):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
lang=lang,
authorization=authorization,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
record_id: str,
*,
client: Union[AuthenticatedClient, Client],
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Create Record Activities
Creates activities associated to the specified record.
**API Endpoint**: POST /v4/records/{recordId}/activities
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.3.2
Args:
record_id (str):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
lang=lang,
authorization=authorization,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)

View file

@ -0,0 +1,173 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...types import UNSET, Response, Unset
def _get_kwargs(
record_id: str,
id: int,
*,
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Dict[str, Any]:
headers = {}
headers["Authorization"] = authorization
params: Dict[str, Any] = {}
params["fields"] = fields
params["lang"] = lang
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return {
"method": "put",
"url": "/v4/records/{recordId}/activities/{id}".format(
recordId=record_id,
id=id,
),
"params": params,
"headers": headers,
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if response.status_code == HTTPStatus.BAD_REQUEST:
return None
if response.status_code == HTTPStatus.UNAUTHORIZED:
return None
if response.status_code == HTTPStatus.FORBIDDEN:
return None
if response.status_code == HTTPStatus.NOT_FOUND:
return None
if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
return None
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
record_id: str,
id: int,
*,
client: Union[AuthenticatedClient, Client],
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Update Record Activity
Updates the activity for the specified record.
**API Endpoint**: PUT /v4/records/{recordId}/activities/{id}
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.3.2
Args:
record_id (str):
id (int):
fields (Union[Unset, None, str]):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
id=id,
fields=fields,
lang=lang,
authorization=authorization,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
record_id: str,
id: int,
*,
client: Union[AuthenticatedClient, Client],
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Update Record Activity
Updates the activity for the specified record.
**API Endpoint**: PUT /v4/records/{recordId}/activities/{id}
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.3.2
Args:
record_id (str):
id (int):
fields (Union[Unset, None, str]):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
id=id,
fields=fields,
lang=lang,
authorization=authorization,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)

View file

@ -0,0 +1,164 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...types import UNSET, Response, Unset
def _get_kwargs(
record_id: str,
id: str,
*,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Dict[str, Any]:
headers = {}
headers["Authorization"] = authorization
params: Dict[str, Any] = {}
params["lang"] = lang
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return {
"method": "delete",
"url": "/v4/records/{recordId}/addresses/{id}".format(
recordId=record_id,
id=id,
),
"params": params,
"headers": headers,
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if response.status_code == HTTPStatus.BAD_REQUEST:
return None
if response.status_code == HTTPStatus.UNAUTHORIZED:
return None
if response.status_code == HTTPStatus.FORBIDDEN:
return None
if response.status_code == HTTPStatus.NOT_FOUND:
return None
if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
return None
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
record_id: str,
id: str,
*,
client: Union[AuthenticatedClient, Client],
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Delete Record Addresses
Deletes addresses from the specified record.
**API Endpoint**: DELETE /v4/records/{recordId}/addresses/{idS}
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
id (str):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
id=id,
lang=lang,
authorization=authorization,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
record_id: str,
id: str,
*,
client: Union[AuthenticatedClient, Client],
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Delete Record Addresses
Deletes addresses from the specified record.
**API Endpoint**: DELETE /v4/records/{recordId}/addresses/{idS}
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
id (str):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
id=id,
lang=lang,
authorization=authorization,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)

View file

@ -0,0 +1,165 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...types import UNSET, Response, Unset
def _get_kwargs(
record_id: str,
*,
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Dict[str, Any]:
headers = {}
headers["Authorization"] = authorization
params: Dict[str, Any] = {}
params["fields"] = fields
params["lang"] = lang
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return {
"method": "get",
"url": "/v4/records/{recordId}/addresses".format(
recordId=record_id,
),
"params": params,
"headers": headers,
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if response.status_code == HTTPStatus.BAD_REQUEST:
return None
if response.status_code == HTTPStatus.UNAUTHORIZED:
return None
if response.status_code == HTTPStatus.FORBIDDEN:
return None
if response.status_code == HTTPStatus.NOT_FOUND:
return None
if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
return None
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
record_id: str,
*,
client: Union[AuthenticatedClient, Client],
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Get All Record Addresses
Gets the addresses linked to the specified record.
**API Endpoint**: GET /v4/records/{recordId}/addresses
**Scope**: records
**App Type**: All
**Authorization Type**: No auth required
**Civic Platform version**: 7.3.3.2
Args:
record_id (str):
fields (Union[Unset, None, str]):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
fields=fields,
lang=lang,
authorization=authorization,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
record_id: str,
*,
client: Union[AuthenticatedClient, Client],
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Get All Record Addresses
Gets the addresses linked to the specified record.
**API Endpoint**: GET /v4/records/{recordId}/addresses
**Scope**: records
**App Type**: All
**Authorization Type**: No auth required
**Civic Platform version**: 7.3.3.2
Args:
record_id (str):
fields (Union[Unset, None, str]):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
fields=fields,
lang=lang,
authorization=authorization,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)

View file

@ -0,0 +1,156 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...types import UNSET, Response, Unset
def _get_kwargs(
record_id: str,
*,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Dict[str, Any]:
headers = {}
headers["Authorization"] = authorization
params: Dict[str, Any] = {}
params["lang"] = lang
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return {
"method": "post",
"url": "/v4/records/{recordId}/addresses".format(
recordId=record_id,
),
"params": params,
"headers": headers,
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if response.status_code == HTTPStatus.BAD_REQUEST:
return None
if response.status_code == HTTPStatus.UNAUTHORIZED:
return None
if response.status_code == HTTPStatus.FORBIDDEN:
return None
if response.status_code == HTTPStatus.NOT_FOUND:
return None
if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
return None
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
record_id: str,
*,
client: Union[AuthenticatedClient, Client],
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Create Record Addresses
Creates new address(es) for the specified record.
**API Endpoint**: POST /v4/records/{recordId}/addresses
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
lang=lang,
authorization=authorization,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
record_id: str,
*,
client: Union[AuthenticatedClient, Client],
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Create Record Addresses
Creates new address(es) for the specified record.
**API Endpoint**: POST /v4/records/{recordId}/addresses
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
lang=lang,
authorization=authorization,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)

View file

@ -0,0 +1,164 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...types import UNSET, Response, Unset
def _get_kwargs(
record_id: str,
id: int,
*,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Dict[str, Any]:
headers = {}
headers["Authorization"] = authorization
params: Dict[str, Any] = {}
params["lang"] = lang
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return {
"method": "put",
"url": "/v4/records/{recordId}/addresses/{id}".format(
recordId=record_id,
id=id,
),
"params": params,
"headers": headers,
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if response.status_code == HTTPStatus.BAD_REQUEST:
return None
if response.status_code == HTTPStatus.UNAUTHORIZED:
return None
if response.status_code == HTTPStatus.FORBIDDEN:
return None
if response.status_code == HTTPStatus.NOT_FOUND:
return None
if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
return None
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
record_id: str,
id: int,
*,
client: Union[AuthenticatedClient, Client],
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Update Record Address
Updates the address for the specified record.
**API Endpoint**: PUT /v4/records/{recordId}/addresses/{id}
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
id (int):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
id=id,
lang=lang,
authorization=authorization,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
record_id: str,
id: int,
*,
client: Union[AuthenticatedClient, Client],
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Update Record Address
Updates the address for the specified record.
**API Endpoint**: PUT /v4/records/{recordId}/addresses/{id}
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
id (int):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
id=id,
lang=lang,
authorization=authorization,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)

View file

@ -0,0 +1,173 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...types import UNSET, Response, Unset
def _get_kwargs(
record_id: str,
address_id: int,
*,
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Dict[str, Any]:
headers = {}
headers["Authorization"] = authorization
params: Dict[str, Any] = {}
params["fields"] = fields
params["lang"] = lang
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return {
"method": "get",
"url": "/v4/records/{recordId}/addresses/{addressId}/customForms".format(
recordId=record_id,
addressId=address_id,
),
"params": params,
"headers": headers,
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if response.status_code == HTTPStatus.BAD_REQUEST:
return None
if response.status_code == HTTPStatus.UNAUTHORIZED:
return None
if response.status_code == HTTPStatus.FORBIDDEN:
return None
if response.status_code == HTTPStatus.NOT_FOUND:
return None
if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
return None
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
record_id: str,
address_id: int,
*,
client: Union[AuthenticatedClient, Client],
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Get Record Address Custom Forms
Returns an array of custom form data associated with a given record address.
**API Endpoint**: GET /v4/records/{recordId}/addresses/{addressId}/customForms
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 9.2.0
Args:
record_id (str):
address_id (int):
fields (Union[Unset, None, str]):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
address_id=address_id,
fields=fields,
lang=lang,
authorization=authorization,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
record_id: str,
address_id: int,
*,
client: Union[AuthenticatedClient, Client],
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Get Record Address Custom Forms
Returns an array of custom form data associated with a given record address.
**API Endpoint**: GET /v4/records/{recordId}/addresses/{addressId}/customForms
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 9.2.0
Args:
record_id (str):
address_id (int):
fields (Union[Unset, None, str]):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
address_id=address_id,
fields=fields,
lang=lang,
authorization=authorization,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)

View file

@ -0,0 +1,173 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...types import UNSET, Response, Unset
def _get_kwargs(
record_id: str,
address_id: int,
*,
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Dict[str, Any]:
headers = {}
headers["Authorization"] = authorization
params: Dict[str, Any] = {}
params["fields"] = fields
params["lang"] = lang
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return {
"method": "get",
"url": "/v4/records/{recordId}/addresses/{addressId}/customForms/meta".format(
recordId=record_id,
addressId=address_id,
),
"params": params,
"headers": headers,
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if response.status_code == HTTPStatus.BAD_REQUEST:
return None
if response.status_code == HTTPStatus.UNAUTHORIZED:
return None
if response.status_code == HTTPStatus.FORBIDDEN:
return None
if response.status_code == HTTPStatus.NOT_FOUND:
return None
if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
return None
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
record_id: str,
address_id: int,
*,
client: Union[AuthenticatedClient, Client],
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Get Record Address Custom Forms Metadata
Returns the field metadata for all custom forms associated with a given record address.
**API Endpoint**: GET /v4/records/{recordId}/addresses/{addressId}/customForms/meta
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 9.2.0
Args:
record_id (str):
address_id (int):
fields (Union[Unset, None, str]):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
address_id=address_id,
fields=fields,
lang=lang,
authorization=authorization,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
record_id: str,
address_id: int,
*,
client: Union[AuthenticatedClient, Client],
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Get Record Address Custom Forms Metadata
Returns the field metadata for all custom forms associated with a given record address.
**API Endpoint**: GET /v4/records/{recordId}/addresses/{addressId}/customForms/meta
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 9.2.0
Args:
record_id (str):
address_id (int):
fields (Union[Unset, None, str]):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
address_id=address_id,
fields=fields,
lang=lang,
authorization=authorization,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)

View file

@ -0,0 +1,164 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...types import UNSET, Response, Unset
def _get_kwargs(
record_id: str,
ids: str,
*,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Dict[str, Any]:
headers = {}
headers["Authorization"] = authorization
params: Dict[str, Any] = {}
params["lang"] = lang
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return {
"method": "delete",
"url": "/v4/records/{recordId}/assets/{ids}".format(
recordId=record_id,
ids=ids,
),
"params": params,
"headers": headers,
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if response.status_code == HTTPStatus.BAD_REQUEST:
return None
if response.status_code == HTTPStatus.UNAUTHORIZED:
return None
if response.status_code == HTTPStatus.FORBIDDEN:
return None
if response.status_code == HTTPStatus.NOT_FOUND:
return None
if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
return None
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
record_id: str,
ids: str,
*,
client: Union[AuthenticatedClient, Client],
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Delete Assets from Record
Deletes one or more assets from a given record.
**API Endpoint**: DELETE /v4/records/{recordId}/assets/{ids}
**Scope**: records
**App Type**: Agency
**Authorization Type**: Access token
**Civic Platform version**: 9.0.0
Args:
record_id (str):
ids (str):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
ids=ids,
lang=lang,
authorization=authorization,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
record_id: str,
ids: str,
*,
client: Union[AuthenticatedClient, Client],
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Delete Assets from Record
Deletes one or more assets from a given record.
**API Endpoint**: DELETE /v4/records/{recordId}/assets/{ids}
**Scope**: records
**App Type**: Agency
**Authorization Type**: Access token
**Civic Platform version**: 9.0.0
Args:
record_id (str):
ids (str):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
ids=ids,
lang=lang,
authorization=authorization,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)

View file

@ -0,0 +1,183 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...types import UNSET, Response, Unset
def _get_kwargs(
record_id: str,
*,
offset: Union[Unset, None, int] = UNSET,
limit: Union[Unset, None, int] = UNSET,
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Dict[str, Any]:
headers = {}
headers["Authorization"] = authorization
params: Dict[str, Any] = {}
params["offset"] = offset
params["limit"] = limit
params["fields"] = fields
params["lang"] = lang
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return {
"method": "get",
"url": "/v4/records/{recordId}/assets".format(
recordId=record_id,
),
"params": params,
"headers": headers,
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if response.status_code == HTTPStatus.BAD_REQUEST:
return None
if response.status_code == HTTPStatus.UNAUTHORIZED:
return None
if response.status_code == HTTPStatus.FORBIDDEN:
return None
if response.status_code == HTTPStatus.NOT_FOUND:
return None
if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
return None
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
record_id: str,
*,
client: Union[AuthenticatedClient, Client],
offset: Union[Unset, None, int] = UNSET,
limit: Union[Unset, None, int] = UNSET,
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Get All Assets for Record
Returns all assets for a given record.
**API Endpoint**: GET /v4/records/{recordId}/assets
**Scope**: records
**App Type**: Agency
**Authorization Type**: Access token
**Civic Platform version**: 9.0.0
Args:
record_id (str):
offset (Union[Unset, None, int]):
limit (Union[Unset, None, int]):
fields (Union[Unset, None, str]):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
offset=offset,
limit=limit,
fields=fields,
lang=lang,
authorization=authorization,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
record_id: str,
*,
client: Union[AuthenticatedClient, Client],
offset: Union[Unset, None, int] = UNSET,
limit: Union[Unset, None, int] = UNSET,
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Get All Assets for Record
Returns all assets for a given record.
**API Endpoint**: GET /v4/records/{recordId}/assets
**Scope**: records
**App Type**: Agency
**Authorization Type**: Access token
**Civic Platform version**: 9.0.0
Args:
record_id (str):
offset (Union[Unset, None, int]):
limit (Union[Unset, None, int]):
fields (Union[Unset, None, str]):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
offset=offset,
limit=limit,
fields=fields,
lang=lang,
authorization=authorization,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)

View file

@ -0,0 +1,183 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...types import UNSET, Response, Unset
def _get_kwargs(
record_id: str,
*,
offset: Union[Unset, None, int] = UNSET,
limit: Union[Unset, None, int] = UNSET,
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Dict[str, Any]:
headers = {}
headers["Authorization"] = authorization
params: Dict[str, Any] = {}
params["offset"] = offset
params["limit"] = limit
params["fields"] = fields
params["lang"] = lang
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return {
"method": "post",
"url": "/v4/records/{recordId}/assets".format(
recordId=record_id,
),
"params": params,
"headers": headers,
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if response.status_code == HTTPStatus.BAD_REQUEST:
return None
if response.status_code == HTTPStatus.UNAUTHORIZED:
return None
if response.status_code == HTTPStatus.FORBIDDEN:
return None
if response.status_code == HTTPStatus.NOT_FOUND:
return None
if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
return None
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
record_id: str,
*,
client: Union[AuthenticatedClient, Client],
offset: Union[Unset, None, int] = UNSET,
limit: Union[Unset, None, int] = UNSET,
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Add Assets to Record
Adds one or more assets to a given record.
**API Endpoint**: POST /v4/records/{recordId}/assets
**Scope**: records
**App Type**: Agency
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
offset (Union[Unset, None, int]):
limit (Union[Unset, None, int]):
fields (Union[Unset, None, str]):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
offset=offset,
limit=limit,
fields=fields,
lang=lang,
authorization=authorization,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
record_id: str,
*,
client: Union[AuthenticatedClient, Client],
offset: Union[Unset, None, int] = UNSET,
limit: Union[Unset, None, int] = UNSET,
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Add Assets to Record
Adds one or more assets to a given record.
**API Endpoint**: POST /v4/records/{recordId}/assets
**Scope**: records
**App Type**: Agency
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
offset (Union[Unset, None, int]):
limit (Union[Unset, None, int]):
fields (Union[Unset, None, str]):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
offset=offset,
limit=limit,
fields=fields,
lang=lang,
authorization=authorization,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)

View file

@ -0,0 +1,192 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...types import UNSET, Response, Unset
def _get_kwargs(
record_id: str,
id: str,
*,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Dict[str, Any]:
headers = {}
headers["Authorization"] = authorization
params: Dict[str, Any] = {}
params["lang"] = lang
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return {
"method": "delete",
"url": "/v4/records/{recordId}/comments/{id}".format(
recordId=record_id,
id=id,
),
"params": params,
"headers": headers,
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if response.status_code == HTTPStatus.BAD_REQUEST:
return None
if response.status_code == HTTPStatus.UNAUTHORIZED:
return None
if response.status_code == HTTPStatus.FORBIDDEN:
return None
if response.status_code == HTTPStatus.NOT_FOUND:
return None
if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
return None
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
record_id: str,
id: str,
*,
client: Union[AuthenticatedClient, Client],
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Delete Record Comments
Deletes the specified comment(s) for the specified record.
**API Endpoint**: DELETE /v4/records/{recordId}/comments/{idS}
**Scope**:
**API Endpoint**:
**Scope**: addresses
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
id (str):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
id=id,
lang=lang,
authorization=authorization,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
record_id: str,
id: str,
*,
client: Union[AuthenticatedClient, Client],
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Delete Record Comments
Deletes the specified comment(s) for the specified record.
**API Endpoint**: DELETE /v4/records/{recordId}/comments/{idS}
**Scope**:
**API Endpoint**:
**Scope**: addresses
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
id (str):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
id=id,
lang=lang,
authorization=authorization,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)

View file

@ -0,0 +1,156 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...types import UNSET, Response, Unset
def _get_kwargs(
record_id: str,
*,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Dict[str, Any]:
headers = {}
headers["Authorization"] = authorization
params: Dict[str, Any] = {}
params["lang"] = lang
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return {
"method": "get",
"url": "/v4/records/{recordId}/comments".format(
recordId=record_id,
),
"params": params,
"headers": headers,
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if response.status_code == HTTPStatus.BAD_REQUEST:
return None
if response.status_code == HTTPStatus.UNAUTHORIZED:
return None
if response.status_code == HTTPStatus.FORBIDDEN:
return None
if response.status_code == HTTPStatus.NOT_FOUND:
return None
if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
return None
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
record_id: str,
*,
client: Union[AuthenticatedClient, Client],
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Get All Comments for Record
Gets comments associated to a record.
**API Endpoint**: GET /v4/records/{recordId}/comments
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
lang=lang,
authorization=authorization,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
record_id: str,
*,
client: Union[AuthenticatedClient, Client],
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Get All Comments for Record
Gets comments associated to a record.
**API Endpoint**: GET /v4/records/{recordId}/comments
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
lang=lang,
authorization=authorization,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)

View file

@ -0,0 +1,156 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...types import UNSET, Response, Unset
def _get_kwargs(
record_id: str,
*,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Dict[str, Any]:
headers = {}
headers["Authorization"] = authorization
params: Dict[str, Any] = {}
params["lang"] = lang
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return {
"method": "post",
"url": "/v4/records/{recordId}/comments".format(
recordId=record_id,
),
"params": params,
"headers": headers,
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if response.status_code == HTTPStatus.BAD_REQUEST:
return None
if response.status_code == HTTPStatus.UNAUTHORIZED:
return None
if response.status_code == HTTPStatus.FORBIDDEN:
return None
if response.status_code == HTTPStatus.NOT_FOUND:
return None
if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
return None
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
record_id: str,
*,
client: Union[AuthenticatedClient, Client],
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Add Comments to a Record
Add comments to a record.
**API Endpoint**: POST /v4/records/{recordId}/comments
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
lang=lang,
authorization=authorization,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
record_id: str,
*,
client: Union[AuthenticatedClient, Client],
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Add Comments to a Record
Add comments to a record.
**API Endpoint**: POST /v4/records/{recordId}/comments
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
lang=lang,
authorization=authorization,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)

View file

@ -0,0 +1,173 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...types import UNSET, Response, Unset
def _get_kwargs(
record_id: str,
id: int,
*,
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Dict[str, Any]:
headers = {}
headers["Authorization"] = authorization
params: Dict[str, Any] = {}
params["fields"] = fields
params["lang"] = lang
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return {
"method": "put",
"url": "/v4/records/{recordId}/comments/{id}".format(
recordId=record_id,
id=id,
),
"params": params,
"headers": headers,
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if response.status_code == HTTPStatus.BAD_REQUEST:
return None
if response.status_code == HTTPStatus.UNAUTHORIZED:
return None
if response.status_code == HTTPStatus.FORBIDDEN:
return None
if response.status_code == HTTPStatus.NOT_FOUND:
return None
if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
return None
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
record_id: str,
id: int,
*,
client: Union[AuthenticatedClient, Client],
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Update Record Comment
Update a record comment.
**API Endpoint**: PUT /v4/records/{recordId}/comments/{id}
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
id (int):
fields (Union[Unset, None, str]):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
id=id,
fields=fields,
lang=lang,
authorization=authorization,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
record_id: str,
id: int,
*,
client: Union[AuthenticatedClient, Client],
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Update Record Comment
Update a record comment.
**API Endpoint**: PUT /v4/records/{recordId}/comments/{id}
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
id (int):
fields (Union[Unset, None, str]):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
id=id,
fields=fields,
lang=lang,
authorization=authorization,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)

View file

@ -0,0 +1,164 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...types import UNSET, Response, Unset
def _get_kwargs(
record_id: str,
id: str,
*,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Dict[str, Any]:
headers = {}
headers["Authorization"] = authorization
params: Dict[str, Any] = {}
params["lang"] = lang
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return {
"method": "delete",
"url": "/v4/records/{recordId}/conditionApprovals/{id}".format(
recordId=record_id,
id=id,
),
"params": params,
"headers": headers,
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if response.status_code == HTTPStatus.BAD_REQUEST:
return None
if response.status_code == HTTPStatus.UNAUTHORIZED:
return None
if response.status_code == HTTPStatus.FORBIDDEN:
return None
if response.status_code == HTTPStatus.NOT_FOUND:
return None
if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
return None
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
record_id: str,
id: str,
*,
client: Union[AuthenticatedClient, Client],
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Delete Record Approval Conditions
Deletes approval conditions for the specified record.
**API Endpoint**: DELETE /v4/records/{recordId}/conditionApprovals/{ids}
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
id (str):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
id=id,
lang=lang,
authorization=authorization,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
record_id: str,
id: str,
*,
client: Union[AuthenticatedClient, Client],
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Delete Record Approval Conditions
Deletes approval conditions for the specified record.
**API Endpoint**: DELETE /v4/records/{recordId}/conditionApprovals/{ids}
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
id (str):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
id=id,
lang=lang,
authorization=authorization,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)

View file

@ -0,0 +1,165 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...types import UNSET, Response, Unset
def _get_kwargs(
record_id: str,
*,
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Dict[str, Any]:
headers = {}
headers["Authorization"] = authorization
params: Dict[str, Any] = {}
params["fields"] = fields
params["lang"] = lang
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return {
"method": "get",
"url": "/v4/records/{recordId}/conditionApprovals".format(
recordId=record_id,
),
"params": params,
"headers": headers,
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if response.status_code == HTTPStatus.BAD_REQUEST:
return None
if response.status_code == HTTPStatus.UNAUTHORIZED:
return None
if response.status_code == HTTPStatus.FORBIDDEN:
return None
if response.status_code == HTTPStatus.NOT_FOUND:
return None
if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
return None
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
record_id: str,
*,
client: Union[AuthenticatedClient, Client],
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Get All Approval Conditions for Record
Gets the conditions of approval for the specified record(s).
**API Endpoint**: GET /v4/records/{recordId}/conditionApprovals
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
fields (Union[Unset, None, str]):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
fields=fields,
lang=lang,
authorization=authorization,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
record_id: str,
*,
client: Union[AuthenticatedClient, Client],
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Get All Approval Conditions for Record
Gets the conditions of approval for the specified record(s).
**API Endpoint**: GET /v4/records/{recordId}/conditionApprovals
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
fields (Union[Unset, None, str]):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
fields=fields,
lang=lang,
authorization=authorization,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)

View file

@ -0,0 +1,173 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...types import UNSET, Response, Unset
def _get_kwargs(
record_id: str,
id: str,
*,
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Dict[str, Any]:
headers = {}
headers["Authorization"] = authorization
params: Dict[str, Any] = {}
params["fields"] = fields
params["lang"] = lang
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return {
"method": "get",
"url": "/v4/records/{recordId}/conditionApprovals/{id}".format(
recordId=record_id,
id=id,
),
"params": params,
"headers": headers,
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if response.status_code == HTTPStatus.BAD_REQUEST:
return None
if response.status_code == HTTPStatus.UNAUTHORIZED:
return None
if response.status_code == HTTPStatus.FORBIDDEN:
return None
if response.status_code == HTTPStatus.NOT_FOUND:
return None
if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
return None
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
record_id: str,
id: str,
*,
client: Union[AuthenticatedClient, Client],
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Get Record Approval Condition
Gets the specified condition of approvals for the specified record(s).
**API Endpoint**: GET /v4/records/{recordId}/conditionApprovals/{id}
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
id (str):
fields (Union[Unset, None, str]):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
id=id,
fields=fields,
lang=lang,
authorization=authorization,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
record_id: str,
id: str,
*,
client: Union[AuthenticatedClient, Client],
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Get Record Approval Condition
Gets the specified condition of approvals for the specified record(s).
**API Endpoint**: GET /v4/records/{recordId}/conditionApprovals/{id}
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
id (str):
fields (Union[Unset, None, str]):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
id=id,
fields=fields,
lang=lang,
authorization=authorization,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)

View file

@ -0,0 +1,156 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...types import UNSET, Response, Unset
def _get_kwargs(
record_id: str,
*,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Dict[str, Any]:
headers = {}
headers["Authorization"] = authorization
params: Dict[str, Any] = {}
params["lang"] = lang
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return {
"method": "post",
"url": "/v4/records/{recordId}/conditionApprovals".format(
recordId=record_id,
),
"params": params,
"headers": headers,
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if response.status_code == HTTPStatus.BAD_REQUEST:
return None
if response.status_code == HTTPStatus.UNAUTHORIZED:
return None
if response.status_code == HTTPStatus.FORBIDDEN:
return None
if response.status_code == HTTPStatus.NOT_FOUND:
return None
if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
return None
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
record_id: str,
*,
client: Union[AuthenticatedClient, Client],
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Create Record Approval Conditions
Adds approval conditions to the specified record.
**API Endpoint**: POST /v4/records/{recordId}/conditionApprovals
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
lang=lang,
authorization=authorization,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
record_id: str,
*,
client: Union[AuthenticatedClient, Client],
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Create Record Approval Conditions
Adds approval conditions to the specified record.
**API Endpoint**: POST /v4/records/{recordId}/conditionApprovals
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
lang=lang,
authorization=authorization,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)

View file

@ -0,0 +1,173 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...types import UNSET, Response, Unset
def _get_kwargs(
record_id: str,
id: str,
*,
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Dict[str, Any]:
headers = {}
headers["Authorization"] = authorization
params: Dict[str, Any] = {}
params["fields"] = fields
params["lang"] = lang
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return {
"method": "put",
"url": "/v4/records/{recordId}/conditionApprovals/{id}".format(
recordId=record_id,
id=id,
),
"params": params,
"headers": headers,
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if response.status_code == HTTPStatus.BAD_REQUEST:
return None
if response.status_code == HTTPStatus.UNAUTHORIZED:
return None
if response.status_code == HTTPStatus.FORBIDDEN:
return None
if response.status_code == HTTPStatus.NOT_FOUND:
return None
if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
return None
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
record_id: str,
id: str,
*,
client: Union[AuthenticatedClient, Client],
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Update Record Approval Condition
Updates the condition of approvals for the specified record(s).
**API Endpoint**: PUT /v4/records/{recordId}/conditionApprovals/{id}
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
id (str):
fields (Union[Unset, None, str]):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
id=id,
fields=fields,
lang=lang,
authorization=authorization,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
record_id: str,
id: str,
*,
client: Union[AuthenticatedClient, Client],
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Update Record Approval Condition
Updates the condition of approvals for the specified record(s).
**API Endpoint**: PUT /v4/records/{recordId}/conditionApprovals/{id}
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
id (str):
fields (Union[Unset, None, str]):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
id=id,
fields=fields,
lang=lang,
authorization=authorization,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)

View file

@ -0,0 +1,164 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...types import UNSET, Response, Unset
def _get_kwargs(
record_id: str,
id: str,
*,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Dict[str, Any]:
headers = {}
headers["Authorization"] = authorization
params: Dict[str, Any] = {}
params["lang"] = lang
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return {
"method": "delete",
"url": "/v4/records/{recordId}/conditions/{id}/histories".format(
recordId=record_id,
id=id,
),
"params": params,
"headers": headers,
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if response.status_code == HTTPStatus.BAD_REQUEST:
return None
if response.status_code == HTTPStatus.UNAUTHORIZED:
return None
if response.status_code == HTTPStatus.FORBIDDEN:
return None
if response.status_code == HTTPStatus.NOT_FOUND:
return None
if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
return None
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
record_id: str,
id: str,
*,
client: Union[AuthenticatedClient, Client],
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Delete Record Conditions
Deletes conditions for the specified record.
**API Endpoint**: DELETE /v4/records/{recordId}/conditions/{ids}
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
id (str):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
id=id,
lang=lang,
authorization=authorization,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
record_id: str,
id: str,
*,
client: Union[AuthenticatedClient, Client],
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Delete Record Conditions
Deletes conditions for the specified record.
**API Endpoint**: DELETE /v4/records/{recordId}/conditions/{ids}
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
id (str):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
id=id,
lang=lang,
authorization=authorization,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)

View file

@ -0,0 +1,165 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...types import UNSET, Response, Unset
def _get_kwargs(
record_id: str,
*,
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Dict[str, Any]:
headers = {}
headers["Authorization"] = authorization
params: Dict[str, Any] = {}
params["fields"] = fields
params["lang"] = lang
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return {
"method": "get",
"url": "/v4/records/{recordId}/conditions".format(
recordId=record_id,
),
"params": params,
"headers": headers,
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if response.status_code == HTTPStatus.BAD_REQUEST:
return None
if response.status_code == HTTPStatus.UNAUTHORIZED:
return None
if response.status_code == HTTPStatus.FORBIDDEN:
return None
if response.status_code == HTTPStatus.NOT_FOUND:
return None
if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
return None
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
record_id: str,
*,
client: Union[AuthenticatedClient, Client],
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Get All Conditions for Record
Gets all conditions for the specified record.
**API Endpoint**: GET /v4/records/{recordId}/conditions
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
fields (Union[Unset, None, str]):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
fields=fields,
lang=lang,
authorization=authorization,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
record_id: str,
*,
client: Union[AuthenticatedClient, Client],
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Get All Conditions for Record
Gets all conditions for the specified record.
**API Endpoint**: GET /v4/records/{recordId}/conditions
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
fields (Union[Unset, None, str]):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
fields=fields,
lang=lang,
authorization=authorization,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)

View file

@ -0,0 +1,173 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...types import UNSET, Response, Unset
def _get_kwargs(
record_id: str,
id: int,
*,
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Dict[str, Any]:
headers = {}
headers["Authorization"] = authorization
params: Dict[str, Any] = {}
params["fields"] = fields
params["lang"] = lang
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return {
"method": "get",
"url": "/v4/records/{recordId}/conditions/{id}".format(
recordId=record_id,
id=id,
),
"params": params,
"headers": headers,
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if response.status_code == HTTPStatus.BAD_REQUEST:
return None
if response.status_code == HTTPStatus.UNAUTHORIZED:
return None
if response.status_code == HTTPStatus.FORBIDDEN:
return None
if response.status_code == HTTPStatus.NOT_FOUND:
return None
if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
return None
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
record_id: str,
id: int,
*,
client: Union[AuthenticatedClient, Client],
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Get Record Condition
Gets a record condition.
**API Endpoint**: GET /v4/records/{recordId}/conditions/{id}
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
id (int):
fields (Union[Unset, None, str]):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
id=id,
fields=fields,
lang=lang,
authorization=authorization,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
record_id: str,
id: int,
*,
client: Union[AuthenticatedClient, Client],
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Get Record Condition
Gets a record condition.
**API Endpoint**: GET /v4/records/{recordId}/conditions/{id}
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
id (int):
fields (Union[Unset, None, str]):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
id=id,
fields=fields,
lang=lang,
authorization=authorization,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)

View file

@ -0,0 +1,173 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...types import UNSET, Response, Unset
def _get_kwargs(
record_id: str,
id: int,
*,
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Dict[str, Any]:
headers = {}
headers["Authorization"] = authorization
params: Dict[str, Any] = {}
params["fields"] = fields
params["lang"] = lang
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return {
"method": "get",
"url": "/v4/records/{recordId}/conditions/{id}/histories".format(
recordId=record_id,
id=id,
),
"params": params,
"headers": headers,
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if response.status_code == HTTPStatus.BAD_REQUEST:
return None
if response.status_code == HTTPStatus.UNAUTHORIZED:
return None
if response.status_code == HTTPStatus.FORBIDDEN:
return None
if response.status_code == HTTPStatus.NOT_FOUND:
return None
if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
return None
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
record_id: str,
id: int,
*,
client: Union[AuthenticatedClient, Client],
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Get History for Record Condition
Gets the history for a given record condition.
**API Endpoint**: GET /v4/records/{recordId}/conditions/{id}/histories
**Scope**: records
**App Type**: Agency
**Authorization Type**: Access token
**Civic Platform version**: 9.0.0
Args:
record_id (str):
id (int):
fields (Union[Unset, None, str]):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
id=id,
fields=fields,
lang=lang,
authorization=authorization,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
record_id: str,
id: int,
*,
client: Union[AuthenticatedClient, Client],
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Get History for Record Condition
Gets the history for a given record condition.
**API Endpoint**: GET /v4/records/{recordId}/conditions/{id}/histories
**Scope**: records
**App Type**: Agency
**Authorization Type**: Access token
**Civic Platform version**: 9.0.0
Args:
record_id (str):
id (int):
fields (Union[Unset, None, str]):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
id=id,
fields=fields,
lang=lang,
authorization=authorization,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)

View file

@ -0,0 +1,156 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...types import UNSET, Response, Unset
def _get_kwargs(
record_id: str,
*,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Dict[str, Any]:
headers = {}
headers["Authorization"] = authorization
params: Dict[str, Any] = {}
params["lang"] = lang
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return {
"method": "post",
"url": "/v4/records/{recordId}/conditions".format(
recordId=record_id,
),
"params": params,
"headers": headers,
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if response.status_code == HTTPStatus.BAD_REQUEST:
return None
if response.status_code == HTTPStatus.UNAUTHORIZED:
return None
if response.status_code == HTTPStatus.FORBIDDEN:
return None
if response.status_code == HTTPStatus.NOT_FOUND:
return None
if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
return None
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
record_id: str,
*,
client: Union[AuthenticatedClient, Client],
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Create Record Conditions
Adds a condition to the specified record.
**API Endpoint**: POST /v4/records/{recordId}/conditions
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
lang=lang,
authorization=authorization,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
record_id: str,
*,
client: Union[AuthenticatedClient, Client],
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Create Record Conditions
Adds a condition to the specified record.
**API Endpoint**: POST /v4/records/{recordId}/conditions
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
lang=lang,
authorization=authorization,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)

View file

@ -0,0 +1,164 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...types import UNSET, Response, Unset
def _get_kwargs(
record_id: str,
id: str,
*,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Dict[str, Any]:
headers = {}
headers["Authorization"] = authorization
params: Dict[str, Any] = {}
params["lang"] = lang
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return {
"method": "put",
"url": "/v4/records/{recordId}/conditions/{id}".format(
recordId=record_id,
id=id,
),
"params": params,
"headers": headers,
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if response.status_code == HTTPStatus.BAD_REQUEST:
return None
if response.status_code == HTTPStatus.UNAUTHORIZED:
return None
if response.status_code == HTTPStatus.FORBIDDEN:
return None
if response.status_code == HTTPStatus.NOT_FOUND:
return None
if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
return None
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
record_id: str,
id: str,
*,
client: Union[AuthenticatedClient, Client],
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Update Record Condition
Update a record condition.
**API Endpoint**: PUT /v4/records/{recordId}/conditions/{id}
**Scope**: addresses
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
id (str):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
id=id,
lang=lang,
authorization=authorization,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
record_id: str,
id: str,
*,
client: Union[AuthenticatedClient, Client],
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Update Record Condition
Update a record condition.
**API Endpoint**: PUT /v4/records/{recordId}/conditions/{id}
**Scope**: addresses
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
id (str):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
id=id,
lang=lang,
authorization=authorization,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)

View file

@ -0,0 +1,172 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...types import UNSET, Response, Unset
def _get_kwargs(
record_id: str,
contact_id: int,
id: str,
*,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Dict[str, Any]:
headers = {}
headers["Authorization"] = authorization
params: Dict[str, Any] = {}
params["lang"] = lang
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return {
"method": "delete",
"url": "/v4/records/{recordId}/contacts/{contactId}/addresses/{id}".format(
recordId=record_id,
contactId=contact_id,
id=id,
),
"params": params,
"headers": headers,
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if response.status_code == HTTPStatus.BAD_REQUEST:
return None
if response.status_code == HTTPStatus.UNAUTHORIZED:
return None
if response.status_code == HTTPStatus.FORBIDDEN:
return None
if response.status_code == HTTPStatus.NOT_FOUND:
return None
if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
return None
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
record_id: str,
contact_id: int,
id: str,
*,
client: Union[AuthenticatedClient, Client],
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Delete Record Contact Addresses
Deletes the specified addresses from the specified contacts and specified records.
**API Endpoint**: DELETE /v4/records/{recordId}/contacts/{contactId}/addresses/{ids}
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
contact_id (int):
id (str):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
contact_id=contact_id,
id=id,
lang=lang,
authorization=authorization,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
record_id: str,
contact_id: int,
id: str,
*,
client: Union[AuthenticatedClient, Client],
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Delete Record Contact Addresses
Deletes the specified addresses from the specified contacts and specified records.
**API Endpoint**: DELETE /v4/records/{recordId}/contacts/{contactId}/addresses/{ids}
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
contact_id (int):
id (str):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
contact_id=contact_id,
id=id,
lang=lang,
authorization=authorization,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)

View file

@ -0,0 +1,173 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...types import UNSET, Response, Unset
def _get_kwargs(
record_id: str,
id: str,
*,
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Dict[str, Any]:
headers = {}
headers["Authorization"] = authorization
params: Dict[str, Any] = {}
params["fields"] = fields
params["lang"] = lang
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return {
"method": "delete",
"url": "/v4/records/{recordId}/contacts/{id}".format(
recordId=record_id,
id=id,
),
"params": params,
"headers": headers,
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if response.status_code == HTTPStatus.BAD_REQUEST:
return None
if response.status_code == HTTPStatus.UNAUTHORIZED:
return None
if response.status_code == HTTPStatus.FORBIDDEN:
return None
if response.status_code == HTTPStatus.NOT_FOUND:
return None
if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
return None
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
record_id: str,
id: str,
*,
client: Union[AuthenticatedClient, Client],
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Delete Record Contacts
Removes the association of specified contacts from a specified record.
**API Endpoint**: DELETE /v4/records/{recordId}/contacts/{ids}
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
id (str):
fields (Union[Unset, None, str]):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
id=id,
fields=fields,
lang=lang,
authorization=authorization,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
record_id: str,
id: str,
*,
client: Union[AuthenticatedClient, Client],
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Delete Record Contacts
Removes the association of specified contacts from a specified record.
**API Endpoint**: DELETE /v4/records/{recordId}/contacts/{ids}
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
id (str):
fields (Union[Unset, None, str]):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
id=id,
fields=fields,
lang=lang,
authorization=authorization,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)

View file

@ -0,0 +1,165 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...types import UNSET, Response, Unset
def _get_kwargs(
record_id: str,
*,
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Dict[str, Any]:
headers = {}
headers["Authorization"] = authorization
params: Dict[str, Any] = {}
params["fields"] = fields
params["lang"] = lang
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return {
"method": "get",
"url": "/v4/records/{recordId}/contacts".format(
recordId=record_id,
),
"params": params,
"headers": headers,
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if response.status_code == HTTPStatus.BAD_REQUEST:
return None
if response.status_code == HTTPStatus.UNAUTHORIZED:
return None
if response.status_code == HTTPStatus.FORBIDDEN:
return None
if response.status_code == HTTPStatus.NOT_FOUND:
return None
if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
return None
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
record_id: str,
*,
client: Union[AuthenticatedClient, Client],
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Get All Contacts for Record
Gets contacts associated to a record.
**API Endpoint**: GET /v4/records/{recordId}/contacts
**Scope**: addresses
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
fields (Union[Unset, None, str]):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
fields=fields,
lang=lang,
authorization=authorization,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
record_id: str,
*,
client: Union[AuthenticatedClient, Client],
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Get All Contacts for Record
Gets contacts associated to a record.
**API Endpoint**: GET /v4/records/{recordId}/contacts
**Scope**: addresses
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
fields (Union[Unset, None, str]):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
fields=fields,
lang=lang,
authorization=authorization,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)

View file

@ -0,0 +1,164 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...types import UNSET, Response, Unset
def _get_kwargs(
record_id: str,
contact_id: int,
*,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Dict[str, Any]:
headers = {}
headers["Authorization"] = authorization
params: Dict[str, Any] = {}
params["lang"] = lang
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return {
"method": "get",
"url": "/v4/records/{recordId}/contacts/{contactId}/addresses".format(
recordId=record_id,
contactId=contact_id,
),
"params": params,
"headers": headers,
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if response.status_code == HTTPStatus.BAD_REQUEST:
return None
if response.status_code == HTTPStatus.UNAUTHORIZED:
return None
if response.status_code == HTTPStatus.FORBIDDEN:
return None
if response.status_code == HTTPStatus.NOT_FOUND:
return None
if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
return None
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
record_id: str,
contact_id: int,
*,
client: Union[AuthenticatedClient, Client],
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Get All Addresses for Contact
Gets the addresses for the specified contacts and specified records.
**API Endpoint**: GET /v4/records/{recordId}/contacts/{contactId}/addresses
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
contact_id (int):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
contact_id=contact_id,
lang=lang,
authorization=authorization,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
record_id: str,
contact_id: int,
*,
client: Union[AuthenticatedClient, Client],
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Get All Addresses for Contact
Gets the addresses for the specified contacts and specified records.
**API Endpoint**: GET /v4/records/{recordId}/contacts/{contactId}/addresses
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
contact_id (int):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
contact_id=contact_id,
lang=lang,
authorization=authorization,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)

View file

@ -0,0 +1,165 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...types import UNSET, Response, Unset
def _get_kwargs(
record_id: str,
*,
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Dict[str, Any]:
headers = {}
headers["Authorization"] = authorization
params: Dict[str, Any] = {}
params["fields"] = fields
params["lang"] = lang
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return {
"method": "post",
"url": "/v4/records/{recordId}/contacts".format(
recordId=record_id,
),
"params": params,
"headers": headers,
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if response.status_code == HTTPStatus.BAD_REQUEST:
return None
if response.status_code == HTTPStatus.UNAUTHORIZED:
return None
if response.status_code == HTTPStatus.FORBIDDEN:
return None
if response.status_code == HTTPStatus.NOT_FOUND:
return None
if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
return None
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
record_id: str,
*,
client: Union[AuthenticatedClient, Client],
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Create Record Contacts
Creates new contact(s) for the specified record.
**API Endpoint**: POST /v4/records/{recordId}/contacts
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
fields (Union[Unset, None, str]):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
fields=fields,
lang=lang,
authorization=authorization,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
record_id: str,
*,
client: Union[AuthenticatedClient, Client],
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Create Record Contacts
Creates new contact(s) for the specified record.
**API Endpoint**: POST /v4/records/{recordId}/contacts
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
fields (Union[Unset, None, str]):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
fields=fields,
lang=lang,
authorization=authorization,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)

View file

@ -0,0 +1,164 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...types import UNSET, Response, Unset
def _get_kwargs(
record_id: str,
contact_id: int,
*,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Dict[str, Any]:
headers = {}
headers["Authorization"] = authorization
params: Dict[str, Any] = {}
params["lang"] = lang
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return {
"method": "post",
"url": "/v4/records/{recordId}/contacts/{contactId}/addresses".format(
recordId=record_id,
contactId=contact_id,
),
"params": params,
"headers": headers,
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if response.status_code == HTTPStatus.BAD_REQUEST:
return None
if response.status_code == HTTPStatus.UNAUTHORIZED:
return None
if response.status_code == HTTPStatus.FORBIDDEN:
return None
if response.status_code == HTTPStatus.NOT_FOUND:
return None
if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
return None
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
record_id: str,
contact_id: int,
*,
client: Union[AuthenticatedClient, Client],
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Create Record Contact Addresses
Creates addresses for the specified contact for the specified record.
**API Endpoint**: POST /v4/records/{recordId}/contacts/{contactId}/addresses
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
contact_id (int):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
contact_id=contact_id,
lang=lang,
authorization=authorization,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
record_id: str,
contact_id: int,
*,
client: Union[AuthenticatedClient, Client],
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Create Record Contact Addresses
Creates addresses for the specified contact for the specified record.
**API Endpoint**: POST /v4/records/{recordId}/contacts/{contactId}/addresses
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
contact_id (int):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
contact_id=contact_id,
lang=lang,
authorization=authorization,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)

View file

@ -0,0 +1,172 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...types import UNSET, Response, Unset
def _get_kwargs(
record_id: str,
contact_id: int,
id: int,
*,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Dict[str, Any]:
headers = {}
headers["Authorization"] = authorization
params: Dict[str, Any] = {}
params["lang"] = lang
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return {
"method": "put",
"url": "/v4/records/{recordId}/contacts/{contactId}/addresses/{id}".format(
recordId=record_id,
contactId=contact_id,
id=id,
),
"params": params,
"headers": headers,
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if response.status_code == HTTPStatus.BAD_REQUEST:
return None
if response.status_code == HTTPStatus.UNAUTHORIZED:
return None
if response.status_code == HTTPStatus.FORBIDDEN:
return None
if response.status_code == HTTPStatus.NOT_FOUND:
return None
if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
return None
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
record_id: str,
contact_id: int,
id: int,
*,
client: Union[AuthenticatedClient, Client],
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Update Record Contact Address
Updates the specified address for the specified contact and specified record.
**API Endpoint**: PUT /v4/records/{recordId}/contacts/{contactId}/addresses/{id}
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
contact_id (int):
id (int):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
contact_id=contact_id,
id=id,
lang=lang,
authorization=authorization,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
record_id: str,
contact_id: int,
id: int,
*,
client: Union[AuthenticatedClient, Client],
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Update Record Contact Address
Updates the specified address for the specified contact and specified record.
**API Endpoint**: PUT /v4/records/{recordId}/contacts/{contactId}/addresses/{id}
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
contact_id (int):
id (int):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
contact_id=contact_id,
id=id,
lang=lang,
authorization=authorization,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)

View file

@ -0,0 +1,173 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...types import UNSET, Response, Unset
def _get_kwargs(
record_id: str,
id: str,
*,
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Dict[str, Any]:
headers = {}
headers["Authorization"] = authorization
params: Dict[str, Any] = {}
params["fields"] = fields
params["lang"] = lang
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return {
"method": "put",
"url": "/v4/records/{recordId}/contacts/{id}".format(
recordId=record_id,
id=id,
),
"params": params,
"headers": headers,
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if response.status_code == HTTPStatus.BAD_REQUEST:
return None
if response.status_code == HTTPStatus.UNAUTHORIZED:
return None
if response.status_code == HTTPStatus.FORBIDDEN:
return None
if response.status_code == HTTPStatus.NOT_FOUND:
return None
if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
return None
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
record_id: str,
id: str,
*,
client: Union[AuthenticatedClient, Client],
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Update Record Contact
Updates information for a specified contact associated with a specified record.
**API Endpoint**: PUT /v4/records/{recordId}/contacts/{id}
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
id (str):
fields (Union[Unset, None, str]):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
id=id,
fields=fields,
lang=lang,
authorization=authorization,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
record_id: str,
id: str,
*,
client: Union[AuthenticatedClient, Client],
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Update Record Contact
Updates information for a specified contact associated with a specified record.
**API Endpoint**: PUT /v4/records/{recordId}/contacts/{id}
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
id (str):
fields (Union[Unset, None, str]):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
id=id,
fields=fields,
lang=lang,
authorization=authorization,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)

View file

@ -0,0 +1,166 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...types import UNSET, Response, Unset
def _get_kwargs(
record_id: str,
contact_id: int,
*,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Dict[str, Any]:
headers = {}
headers["Authorization"] = authorization
params: Dict[str, Any] = {}
params["lang"] = lang
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return {
"method": "get",
"url": "/v4/records/{recordId}/contacts/{contactId}/customForms".format(
recordId=record_id,
contactId=contact_id,
),
"params": params,
"headers": headers,
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if response.status_code == HTTPStatus.BAD_REQUEST:
return None
if response.status_code == HTTPStatus.UNAUTHORIZED:
return None
if response.status_code == HTTPStatus.FORBIDDEN:
return None
if response.status_code == HTTPStatus.NOT_FOUND:
return None
if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
return None
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
record_id: str,
contact_id: int,
*,
client: Union[AuthenticatedClient, Client],
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Get Record Contacts Custom Forms
Returns an array of custom forms associated with the specified record contact. Each custom form
consists of the custom form id and custom field name-and-value pairs.
**API Endpoint**: GET /v4/records/{recordId}/contacts/{contactId}/customForms
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
contact_id (int):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
contact_id=contact_id,
lang=lang,
authorization=authorization,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
record_id: str,
contact_id: int,
*,
client: Union[AuthenticatedClient, Client],
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Get Record Contacts Custom Forms
Returns an array of custom forms associated with the specified record contact. Each custom form
consists of the custom form id and custom field name-and-value pairs.
**API Endpoint**: GET /v4/records/{recordId}/contacts/{contactId}/customForms
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
contact_id (int):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
contact_id=contact_id,
lang=lang,
authorization=authorization,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)

View file

@ -0,0 +1,181 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...types import UNSET, Response, Unset
def _get_kwargs(
record_id: str,
contact_id: int,
form_id: str,
*,
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Dict[str, Any]:
headers = {}
headers["Authorization"] = authorization
params: Dict[str, Any] = {}
params["fields"] = fields
params["lang"] = lang
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return {
"method": "get",
"url": "/v4/records/{recordId}/contacts/{contactId}/customForms/{formId}/meta".format(
recordId=record_id,
contactId=contact_id,
formId=form_id,
),
"params": params,
"headers": headers,
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if response.status_code == HTTPStatus.BAD_REQUEST:
return None
if response.status_code == HTTPStatus.UNAUTHORIZED:
return None
if response.status_code == HTTPStatus.FORBIDDEN:
return None
if response.status_code == HTTPStatus.NOT_FOUND:
return None
if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
return None
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
record_id: str,
contact_id: int,
form_id: str,
*,
client: Union[AuthenticatedClient, Client],
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Get Record Contact Custom Form Metadata
Gets the metadata associated with the requested custom form for the record contact.
**API Endpoint**: GET /v4/records/{recordId}/contacts/{contactId}/customForms/{formId}/meta
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 9.2.0
Args:
record_id (str):
contact_id (int):
form_id (str):
fields (Union[Unset, None, str]):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
contact_id=contact_id,
form_id=form_id,
fields=fields,
lang=lang,
authorization=authorization,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
record_id: str,
contact_id: int,
form_id: str,
*,
client: Union[AuthenticatedClient, Client],
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Get Record Contact Custom Form Metadata
Gets the metadata associated with the requested custom form for the record contact.
**API Endpoint**: GET /v4/records/{recordId}/contacts/{contactId}/customForms/{formId}/meta
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 9.2.0
Args:
record_id (str):
contact_id (int):
form_id (str):
fields (Union[Unset, None, str]):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
contact_id=contact_id,
form_id=form_id,
fields=fields,
lang=lang,
authorization=authorization,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)

View file

@ -0,0 +1,173 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...types import UNSET, Response, Unset
def _get_kwargs(
record_id: str,
contact_id: int,
*,
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Dict[str, Any]:
headers = {}
headers["Authorization"] = authorization
params: Dict[str, Any] = {}
params["fields"] = fields
params["lang"] = lang
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return {
"method": "get",
"url": "/v4/records/{recordId}/contacts/{contactId}/customForms/meta".format(
recordId=record_id,
contactId=contact_id,
),
"params": params,
"headers": headers,
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if response.status_code == HTTPStatus.BAD_REQUEST:
return None
if response.status_code == HTTPStatus.UNAUTHORIZED:
return None
if response.status_code == HTTPStatus.FORBIDDEN:
return None
if response.status_code == HTTPStatus.NOT_FOUND:
return None
if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
return None
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
record_id: str,
contact_id: int,
*,
client: Union[AuthenticatedClient, Client],
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Get Record Contacts Custom Forms Meta
Gets the custom forms metadata associated with the specified record contact.
**API Endpoint**: GET /v4/records/{recordId}/contacts/{contactId}/customForms/meta
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
contact_id (int):
fields (Union[Unset, None, str]):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
contact_id=contact_id,
fields=fields,
lang=lang,
authorization=authorization,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
record_id: str,
contact_id: int,
*,
client: Union[AuthenticatedClient, Client],
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Get Record Contacts Custom Forms Meta
Gets the custom forms metadata associated with the specified record contact.
**API Endpoint**: GET /v4/records/{recordId}/contacts/{contactId}/customForms/meta
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
contact_id (int):
fields (Union[Unset, None, str]):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
contact_id=contact_id,
fields=fields,
lang=lang,
authorization=authorization,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)

View file

@ -0,0 +1,166 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...types import UNSET, Response, Unset
def _get_kwargs(
record_id: str,
contact_id: int,
*,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Dict[str, Any]:
headers = {}
headers["Authorization"] = authorization
params: Dict[str, Any] = {}
params["lang"] = lang
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return {
"method": "put",
"url": "/v4/records/{recordId}/contacts/{contactId}/customForms".format(
recordId=record_id,
contactId=contact_id,
),
"params": params,
"headers": headers,
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if response.status_code == HTTPStatus.BAD_REQUEST:
return None
if response.status_code == HTTPStatus.UNAUTHORIZED:
return None
if response.status_code == HTTPStatus.FORBIDDEN:
return None
if response.status_code == HTTPStatus.NOT_FOUND:
return None
if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
return None
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
record_id: str,
contact_id: int,
*,
client: Union[AuthenticatedClient, Client],
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Update Record Contact Custom Forms
Updates the custom forms for the specified record contact. The request body is an array of custom
forms, with each item containing the custom form's id and custom field name/value pairs.
**API Endpoint**: PUT /v4/records/{recordId}/contacts/{contactId}/customForms
**Scope**: records
**App Type**: Agency
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
contact_id (int):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
contact_id=contact_id,
lang=lang,
authorization=authorization,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
record_id: str,
contact_id: int,
*,
client: Union[AuthenticatedClient, Client],
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Update Record Contact Custom Forms
Updates the custom forms for the specified record contact. The request body is an array of custom
forms, with each item containing the custom form's id and custom field name/value pairs.
**API Endpoint**: PUT /v4/records/{recordId}/contacts/{contactId}/customForms
**Scope**: records
**App Type**: Agency
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
contact_id (int):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
contact_id=contact_id,
lang=lang,
authorization=authorization,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)

View file

@ -0,0 +1,173 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...types import UNSET, Response, Unset
def _get_kwargs(
record_id: str,
contact_id: int,
*,
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Dict[str, Any]:
headers = {}
headers["Authorization"] = authorization
params: Dict[str, Any] = {}
params["fields"] = fields
params["lang"] = lang
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return {
"method": "get",
"url": "/v4/records/{recordId}/contacts/{contactId}/customTables".format(
recordId=record_id,
contactId=contact_id,
),
"params": params,
"headers": headers,
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if response.status_code == HTTPStatus.BAD_REQUEST:
return None
if response.status_code == HTTPStatus.UNAUTHORIZED:
return None
if response.status_code == HTTPStatus.FORBIDDEN:
return None
if response.status_code == HTTPStatus.NOT_FOUND:
return None
if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
return None
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
record_id: str,
contact_id: int,
*,
client: Union[AuthenticatedClient, Client],
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Get All Custom Tables for Record Contact
Gets the custom tables associated with the specified record contact.
**API Endpoint**: GET /v4/records/{recordId}/contacts/{contactId}/customTables
**Scope**: records
**App Type**: Agency
**Authorization Type**: Access token
**Civic Platform version**: 8.0.3
Args:
record_id (str):
contact_id (int):
fields (Union[Unset, None, str]):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
contact_id=contact_id,
fields=fields,
lang=lang,
authorization=authorization,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
record_id: str,
contact_id: int,
*,
client: Union[AuthenticatedClient, Client],
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Get All Custom Tables for Record Contact
Gets the custom tables associated with the specified record contact.
**API Endpoint**: GET /v4/records/{recordId}/contacts/{contactId}/customTables
**Scope**: records
**App Type**: Agency
**Authorization Type**: Access token
**Civic Platform version**: 8.0.3
Args:
record_id (str):
contact_id (int):
fields (Union[Unset, None, str]):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
contact_id=contact_id,
fields=fields,
lang=lang,
authorization=authorization,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)

View file

@ -0,0 +1,173 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...types import UNSET, Response, Unset
def _get_kwargs(
record_id: str,
contact_id: int,
*,
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Dict[str, Any]:
headers = {}
headers["Authorization"] = authorization
params: Dict[str, Any] = {}
params["fields"] = fields
params["lang"] = lang
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return {
"method": "get",
"url": "/v4/records/{recordId}/contacts/{contactId}/customTables/meta".format(
recordId=record_id,
contactId=contact_id,
),
"params": params,
"headers": headers,
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if response.status_code == HTTPStatus.BAD_REQUEST:
return None
if response.status_code == HTTPStatus.UNAUTHORIZED:
return None
if response.status_code == HTTPStatus.FORBIDDEN:
return None
if response.status_code == HTTPStatus.NOT_FOUND:
return None
if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
return None
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
record_id: str,
contact_id: int,
*,
client: Union[AuthenticatedClient, Client],
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Get Metadata of All Record Contact Custom Tables
Gets the metadata of all custom tables associated with the specified record contact.
**API Endpoint**: GET /v4/records/{recordId}/contacts/{contactId}/customTables/meta
**Scope**: records
**App Type**: Agency
**Authorization Type**: Access token
**Civic Platform version**: 8.0.3
Args:
record_id (str):
contact_id (int):
fields (Union[Unset, None, str]):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
contact_id=contact_id,
fields=fields,
lang=lang,
authorization=authorization,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
record_id: str,
contact_id: int,
*,
client: Union[AuthenticatedClient, Client],
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Get Metadata of All Record Contact Custom Tables
Gets the metadata of all custom tables associated with the specified record contact.
**API Endpoint**: GET /v4/records/{recordId}/contacts/{contactId}/customTables/meta
**Scope**: records
**App Type**: Agency
**Authorization Type**: Access token
**Civic Platform version**: 8.0.3
Args:
record_id (str):
contact_id (int):
fields (Union[Unset, None, str]):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
contact_id=contact_id,
fields=fields,
lang=lang,
authorization=authorization,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)

View file

@ -0,0 +1,181 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...types import UNSET, Response, Unset
def _get_kwargs(
record_id: str,
contact_id: int,
table_id: str,
*,
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Dict[str, Any]:
headers = {}
headers["Authorization"] = authorization
params: Dict[str, Any] = {}
params["fields"] = fields
params["lang"] = lang
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return {
"method": "get",
"url": "/v4/records/{recordId}/contacts/{contactId}/customTables/{tableId}/meta".format(
recordId=record_id,
contactId=contact_id,
tableId=table_id,
),
"params": params,
"headers": headers,
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if response.status_code == HTTPStatus.BAD_REQUEST:
return None
if response.status_code == HTTPStatus.UNAUTHORIZED:
return None
if response.status_code == HTTPStatus.FORBIDDEN:
return None
if response.status_code == HTTPStatus.NOT_FOUND:
return None
if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
return None
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
record_id: str,
contact_id: int,
table_id: str,
*,
client: Union[AuthenticatedClient, Client],
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Get Metadata of a Record Contact Custom Table
Gets the metadata of a specified custom table associated with the specified record contact.
**API Endpoint**: GET /v4/records/{recordId}/contacts/{contactId}/customTables/{tableId}/meta
**Scope**: records
**App Type**: Agency
**Authorization Type**: Access token
**Civic Platform version**: 8.0.3
Args:
record_id (str):
contact_id (int):
table_id (str):
fields (Union[Unset, None, str]):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
contact_id=contact_id,
table_id=table_id,
fields=fields,
lang=lang,
authorization=authorization,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
record_id: str,
contact_id: int,
table_id: str,
*,
client: Union[AuthenticatedClient, Client],
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Get Metadata of a Record Contact Custom Table
Gets the metadata of a specified custom table associated with the specified record contact.
**API Endpoint**: GET /v4/records/{recordId}/contacts/{contactId}/customTables/{tableId}/meta
**Scope**: records
**App Type**: Agency
**Authorization Type**: Access token
**Civic Platform version**: 8.0.3
Args:
record_id (str):
contact_id (int):
table_id (str):
fields (Union[Unset, None, str]):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
contact_id=contact_id,
table_id=table_id,
fields=fields,
lang=lang,
authorization=authorization,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)

View file

@ -0,0 +1,181 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...types import UNSET, Response, Unset
def _get_kwargs(
record_id: str,
contact_id: int,
*,
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Dict[str, Any]:
headers = {}
headers["Authorization"] = authorization
params: Dict[str, Any] = {}
params["fields"] = fields
params["lang"] = lang
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return {
"method": "put",
"url": "/v4/records/{recordId}/contacts/{contactId}/customTables".format(
recordId=record_id,
contactId=contact_id,
),
"params": params,
"headers": headers,
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if response.status_code == HTTPStatus.BAD_REQUEST:
return None
if response.status_code == HTTPStatus.UNAUTHORIZED:
return None
if response.status_code == HTTPStatus.FORBIDDEN:
return None
if response.status_code == HTTPStatus.NOT_FOUND:
return None
if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
return None
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
record_id: str,
contact_id: int,
*,
client: Union[AuthenticatedClient, Client],
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Update Record Custom Tables
Updates the custom tables for the specified record contact. The request body is an array of custom
tables, each with the custom table id and an array of rows. Use this API to add, update and delete
rows from an existing custom table. (Custom tables are defined in Civic Platform.) Note that the
modified custom table data only applies to the transactional record contact, not the reference
contact.
**API Endpoint**: PUT /v4/records/{recordId}/contacts/{contactId}/customTables
**Scope**: records
**App Type**: Agency
**Authorization Type**: Access token
**Civic Platform version**: 8.0.3
Args:
record_id (str):
contact_id (int):
fields (Union[Unset, None, str]):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
contact_id=contact_id,
fields=fields,
lang=lang,
authorization=authorization,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
record_id: str,
contact_id: int,
*,
client: Union[AuthenticatedClient, Client],
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Update Record Custom Tables
Updates the custom tables for the specified record contact. The request body is an array of custom
tables, each with the custom table id and an array of rows. Use this API to add, update and delete
rows from an existing custom table. (Custom tables are defined in Civic Platform.) Note that the
modified custom table data only applies to the transactional record contact, not the reference
contact.
**API Endpoint**: PUT /v4/records/{recordId}/contacts/{contactId}/customTables
**Scope**: records
**App Type**: Agency
**Authorization Type**: Access token
**Civic Platform version**: 8.0.3
Args:
record_id (str):
contact_id (int):
fields (Union[Unset, None, str]):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
contact_id=contact_id,
fields=fields,
lang=lang,
authorization=authorization,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)

View file

@ -0,0 +1,164 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...types import UNSET, Response, Unset
def _get_kwargs(
record_id: str,
ids: str,
*,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Dict[str, Any]:
headers = {}
headers["Authorization"] = authorization
params: Dict[str, Any] = {}
params["lang"] = lang
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return {
"method": "delete",
"url": "/v4/records/{recordId}/costs/{ids}".format(
recordId=record_id,
ids=ids,
),
"params": params,
"headers": headers,
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if response.status_code == HTTPStatus.BAD_REQUEST:
return None
if response.status_code == HTTPStatus.UNAUTHORIZED:
return None
if response.status_code == HTTPStatus.FORBIDDEN:
return None
if response.status_code == HTTPStatus.NOT_FOUND:
return None
if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
return None
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
record_id: str,
ids: str,
*,
client: Union[AuthenticatedClient, Client],
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Delete Record Costs
Deletes one or more costs from a given record.
**API Endpoint**: DELETE /v4/records/{recordId}/costs/{ids}
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 9.0.0
Args:
record_id (str):
ids (str):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
ids=ids,
lang=lang,
authorization=authorization,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
record_id: str,
ids: str,
*,
client: Union[AuthenticatedClient, Client],
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Delete Record Costs
Deletes one or more costs from a given record.
**API Endpoint**: DELETE /v4/records/{recordId}/costs/{ids}
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 9.0.0
Args:
record_id (str):
ids (str):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
ids=ids,
lang=lang,
authorization=authorization,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)

View file

@ -0,0 +1,165 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...types import UNSET, Response, Unset
def _get_kwargs(
record_id: str,
*,
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Dict[str, Any]:
headers = {}
headers["Authorization"] = authorization
params: Dict[str, Any] = {}
params["fields"] = fields
params["lang"] = lang
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return {
"method": "get",
"url": "/v4/records/{recordId}/costs".format(
recordId=record_id,
),
"params": params,
"headers": headers,
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if response.status_code == HTTPStatus.BAD_REQUEST:
return None
if response.status_code == HTTPStatus.UNAUTHORIZED:
return None
if response.status_code == HTTPStatus.FORBIDDEN:
return None
if response.status_code == HTTPStatus.NOT_FOUND:
return None
if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
return None
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
record_id: str,
*,
client: Union[AuthenticatedClient, Client],
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Get Record Costs
Returns the costs associated to a given record.
**API Endpoint**: GET /v4/records/{recordId}/costs
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
fields (Union[Unset, None, str]):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
fields=fields,
lang=lang,
authorization=authorization,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
record_id: str,
*,
client: Union[AuthenticatedClient, Client],
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Get Record Costs
Returns the costs associated to a given record.
**API Endpoint**: GET /v4/records/{recordId}/costs
**Scope**: records
**App Type**: All
**Authorization Type**: Access token
**Civic Platform version**: 7.3.2
Args:
record_id (str):
fields (Union[Unset, None, str]):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
fields=fields,
lang=lang,
authorization=authorization,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)

View file

@ -0,0 +1,164 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...types import UNSET, Response, Unset
def _get_kwargs(
record_id: str,
ids: str,
*,
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Dict[str, Any]:
headers = {}
headers["Authorization"] = authorization
params: Dict[str, Any] = {}
params["lang"] = lang
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return {
"method": "put",
"url": "/v4/records/{recordId}/costs/{ids}".format(
recordId=record_id,
ids=ids,
),
"params": params,
"headers": headers,
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if response.status_code == HTTPStatus.BAD_REQUEST:
return None
if response.status_code == HTTPStatus.UNAUTHORIZED:
return None
if response.status_code == HTTPStatus.FORBIDDEN:
return None
if response.status_code == HTTPStatus.NOT_FOUND:
return None
if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
return None
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
record_id: str,
ids: str,
*,
client: Union[AuthenticatedClient, Client],
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Update Record Costs
Update the details of the costs for given records.
**API Endpoint**: PUT /v4/records/{recordId}/costs/{id}
**Scope**: costs
**App Type**: Agency
**Authorization Type**: Access token
**Civic Platform version**: 20.1.4
Args:
record_id (str):
ids (str):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
ids=ids,
lang=lang,
authorization=authorization,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
record_id: str,
ids: str,
*,
client: Union[AuthenticatedClient, Client],
lang: Union[Unset, None, str] = UNSET,
authorization: str,
) -> Response[Any]:
"""Update Record Costs
Update the details of the costs for given records.
**API Endpoint**: PUT /v4/records/{recordId}/costs/{id}
**Scope**: costs
**App Type**: Agency
**Authorization Type**: Access token
**Civic Platform version**: 20.1.4
Args:
record_id (str):
ids (str):
lang (Union[Unset, None, str]):
authorization (str):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
ids=ids,
lang=lang,
authorization=authorization,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)

View file

@ -0,0 +1,158 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...types import UNSET, Response, Unset
def _get_kwargs(
record_id: str,
*,
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
) -> Dict[str, Any]:
pass
params: Dict[str, Any] = {}
params["fields"] = fields
params["lang"] = lang
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return {
"method": "get",
"url": "/v4/records/{recordId}/customForms".format(
recordId=record_id,
),
"params": params,
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if response.status_code == HTTPStatus.BAD_REQUEST:
return None
if response.status_code == HTTPStatus.UNAUTHORIZED:
return None
if response.status_code == HTTPStatus.FORBIDDEN:
return None
if response.status_code == HTTPStatus.NOT_FOUND:
return None
if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
return None
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
record_id: str,
*,
client: Union[AuthenticatedClient, Client],
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
) -> Response[Any]:
"""Get All Custom Forms for Record
Returns an array of custom forms associated with the specified record. Each custom form consists of
custom field name-and-value pairs.
**API Endpoint**: GET /v4/records/{recordId}/customForms
**Scope**: records
**App Type**: All
**Authorization Type**: No authorization required
**Civic Platform version**: 7.3.2
Args:
record_id (str):
fields (Union[Unset, None, str]):
lang (Union[Unset, None, str]):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
fields=fields,
lang=lang,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
record_id: str,
*,
client: Union[AuthenticatedClient, Client],
fields: Union[Unset, None, str] = UNSET,
lang: Union[Unset, None, str] = UNSET,
) -> Response[Any]:
"""Get All Custom Forms for Record
Returns an array of custom forms associated with the specified record. Each custom form consists of
custom field name-and-value pairs.
**API Endpoint**: GET /v4/records/{recordId}/customForms
**Scope**: records
**App Type**: All
**Authorization Type**: No authorization required
**Civic Platform version**: 7.3.2
Args:
record_id (str):
fields (Union[Unset, None, str]):
lang (Union[Unset, None, str]):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
fields=fields,
lang=lang,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)

View file

@ -0,0 +1,155 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...types import UNSET, Response, Unset
def _get_kwargs(
record_id: str,
form_id: str,
*,
lang: Union[Unset, None, str] = UNSET,
) -> Dict[str, Any]:
pass
params: Dict[str, Any] = {}
params["lang"] = lang
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return {
"method": "get",
"url": "/v4/records/{recordId}/customForms/{formId}/meta".format(
recordId=record_id,
formId=form_id,
),
"params": params,
}
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if response.status_code == HTTPStatus.BAD_REQUEST:
return None
if response.status_code == HTTPStatus.UNAUTHORIZED:
return None
if response.status_code == HTTPStatus.FORBIDDEN:
return None
if response.status_code == HTTPStatus.NOT_FOUND:
return None
if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
return None
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
record_id: str,
form_id: str,
*,
client: Union[AuthenticatedClient, Client],
lang: Union[Unset, None, str] = UNSET,
) -> Response[Any]:
"""Get Custom Form Metadata for Record
Gets the detailed data associated with the specified custom form for the specified record.
**API Endpoint**: GET /v4/records/{recordId}/customForms/{formId}/meta
**Scope**: records
**App Type**: All
**Authorization Type**: No authorization required
**Civic Platform version**: 7.3.2
Args:
record_id (str):
form_id (str):
lang (Union[Unset, None, str]):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
form_id=form_id,
lang=lang,
)
response = client.get_httpx_client().request(
**kwargs,
)
return _build_response(client=client, response=response)
async def asyncio_detailed(
record_id: str,
form_id: str,
*,
client: Union[AuthenticatedClient, Client],
lang: Union[Unset, None, str] = UNSET,
) -> Response[Any]:
"""Get Custom Form Metadata for Record
Gets the detailed data associated with the specified custom form for the specified record.
**API Endpoint**: GET /v4/records/{recordId}/customForms/{formId}/meta
**Scope**: records
**App Type**: All
**Authorization Type**: No authorization required
**Civic Platform version**: 7.3.2
Args:
record_id (str):
form_id (str):
lang (Union[Unset, None, str]):
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Any]
"""
kwargs = _get_kwargs(
record_id=record_id,
form_id=form_id,
lang=lang,
)
response = await client.get_async_httpx_client().request(**kwargs)
return _build_response(client=client, response=response)

Some files were not shown because too many files have changed in this diff Show more