Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,10 @@ def sync_detailed(
materialization required. One entity's books: `entity_id` names a subsidiary, omitted means the
group parent. On the parent, `scope: combined` sums every member consolidated in full at the rs-gaap
concepts for the months each was a member, nothing eliminated, and `scope: consolidated` adds the
consolidation entity's entries — the eliminations and noncontrolling interest. Rejected on shared-
repository graphs; those should use `financial-statement-analysis` instead.
consolidation entity's entries — the eliminations and noncontrolling interest. `dimension` slices an
income statement by department, class, location or project: one member's lines, or a column per
member with Unallocated and Total. Rejected on shared-repository graphs; those should use
`financial-statement-analysis` instead.

**Idempotency**: supply an `Idempotency-Key` header to make safe retries; replays within 24 hours
return the same envelope. Reusing the key with a different body returns HTTP 409 Conflict.
Expand Down Expand Up @@ -167,8 +169,10 @@ def sync(
materialization required. One entity's books: `entity_id` names a subsidiary, omitted means the
group parent. On the parent, `scope: combined` sums every member consolidated in full at the rs-gaap
concepts for the months each was a member, nothing eliminated, and `scope: consolidated` adds the
consolidation entity's entries — the eliminations and noncontrolling interest. Rejected on shared-
repository graphs; those should use `financial-statement-analysis` instead.
consolidation entity's entries — the eliminations and noncontrolling interest. `dimension` slices an
income statement by department, class, location or project: one member's lines, or a column per
member with Unallocated and Total. Rejected on shared-repository graphs; those should use
`financial-statement-analysis` instead.

**Idempotency**: supply an `Idempotency-Key` header to make safe retries; replays within 24 hours
return the same envelope. Reusing the key with a different body returns HTTP 409 Conflict.
Expand Down Expand Up @@ -209,8 +213,10 @@ async def asyncio_detailed(
materialization required. One entity's books: `entity_id` names a subsidiary, omitted means the
group parent. On the parent, `scope: combined` sums every member consolidated in full at the rs-gaap
concepts for the months each was a member, nothing eliminated, and `scope: consolidated` adds the
consolidation entity's entries — the eliminations and noncontrolling interest. Rejected on shared-
repository graphs; those should use `financial-statement-analysis` instead.
consolidation entity's entries — the eliminations and noncontrolling interest. `dimension` slices an
income statement by department, class, location or project: one member's lines, or a column per
member with Unallocated and Total. Rejected on shared-repository graphs; those should use
`financial-statement-analysis` instead.

**Idempotency**: supply an `Idempotency-Key` header to make safe retries; replays within 24 hours
return the same envelope. Reusing the key with a different body returns HTTP 409 Conflict.
Expand Down Expand Up @@ -254,8 +260,10 @@ async def asyncio(
materialization required. One entity's books: `entity_id` names a subsidiary, omitted means the
group parent. On the parent, `scope: combined` sums every member consolidated in full at the rs-gaap
concepts for the months each was a member, nothing eliminated, and `scope: consolidated` adds the
consolidation entity's entries — the eliminations and noncontrolling interest. Rejected on shared-
repository graphs; those should use `financial-statement-analysis` instead.
consolidation entity's entries — the eliminations and noncontrolling interest. `dimension` slices an
income statement by department, class, location or project: one member's lines, or a column per
member with Unallocated and Total. Rejected on shared-repository graphs; those should use
`financial-statement-analysis` instead.

**Idempotency**: supply an `Idempotency-Key` header to make safe retries; replays within 24 hours
return the same envelope. Reusing the key with a different body returns HTTP 409 Conflict.
Expand Down
270 changes: 270 additions & 0 deletions robosystems_client/api/robo_ledger_ledger_events/create_dimension.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,270 @@
from http import HTTPStatus
from typing import Any
from urllib.parse import quote

import httpx

from ... import errors
from ...client import AuthenticatedClient, Client
from ...models.create_dimension_request import CreateDimensionRequest
from ...models.error_response import ErrorResponse
from ...models.operation_envelope_dimension_response import (
OperationEnvelopeDimensionResponse,
)
from ...types import UNSET, Response, Unset


def _get_kwargs(
graph_id: str,
*,
body: CreateDimensionRequest,
idempotency_key: None | str | Unset = UNSET,
) -> dict[str, Any]:
headers: dict[str, Any] = {}
if not isinstance(idempotency_key, Unset):
headers["Idempotency-Key"] = idempotency_key

_kwargs: dict[str, Any] = {
"method": "post",
"url": "/extensions/roboledger/{graph_id}/operations/create-dimension".format(
graph_id=quote(str(graph_id), safe=""),
),
}

_kwargs["json"] = body.to_dict()

headers["Content-Type"] = "application/json"

_kwargs["headers"] = headers
return _kwargs


def _parse_response(
*, client: AuthenticatedClient | Client, response: httpx.Response
) -> ErrorResponse | OperationEnvelopeDimensionResponse | None:
if response.status_code == 200:
response_200 = OperationEnvelopeDimensionResponse.from_dict(response.json())

return response_200

if response.status_code == 400:
response_400 = ErrorResponse.from_dict(response.json())

return response_400

if response.status_code == 401:
response_401 = ErrorResponse.from_dict(response.json())

return response_401

if response.status_code == 403:
response_403 = ErrorResponse.from_dict(response.json())

return response_403

if response.status_code == 404:
response_404 = ErrorResponse.from_dict(response.json())

return response_404

if response.status_code == 409:
response_409 = ErrorResponse.from_dict(response.json())

return response_409

if response.status_code == 422:
response_422 = ErrorResponse.from_dict(response.json())

return response_422

if response.status_code == 429:
response_429 = ErrorResponse.from_dict(response.json())

return response_429

if response.status_code == 500:
response_500 = ErrorResponse.from_dict(response.json())

return response_500

if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None


def _build_response(
*, client: AuthenticatedClient | Client, response: httpx.Response
) -> Response[ErrorResponse | OperationEnvelopeDimensionResponse]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)


def sync_detailed(
graph_id: str,
*,
client: AuthenticatedClient,
body: CreateDimensionRequest,
idempotency_key: None | str | Unset = UNSET,
) -> Response[ErrorResponse | OperationEnvelopeDimensionResponse]:
"""Create Dimension

Add a member to a management dimension: a department, class, location or project (or an axis of your
own) that ledger lines can carry, one member per axis per line. `value` is the member's stable key
within its axis, a slug of the name when omitted; a second member with the same key returns 409. Tag
lines with its id through `dimension_ids` on a journal line, and read the income statement by it
with `live-financial-statement`'s `dimension`.

**Idempotency**: supply an `Idempotency-Key` header to make safe retries; replays within 24 hours
return the same envelope. Reusing the key with a different body returns HTTP 409 Conflict.

Args:
graph_id (str):
idempotency_key (None | str | Unset):
body (CreateDimensionRequest): Add a member to a management dimension.

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[ErrorResponse | OperationEnvelopeDimensionResponse]
"""

kwargs = _get_kwargs(
graph_id=graph_id,
body=body,
idempotency_key=idempotency_key,
)

response = client.get_httpx_client().request(
**kwargs,
)

return _build_response(client=client, response=response)


def sync(
graph_id: str,
*,
client: AuthenticatedClient,
body: CreateDimensionRequest,
idempotency_key: None | str | Unset = UNSET,
) -> ErrorResponse | OperationEnvelopeDimensionResponse | None:
"""Create Dimension

Add a member to a management dimension: a department, class, location or project (or an axis of your
own) that ledger lines can carry, one member per axis per line. `value` is the member's stable key
within its axis, a slug of the name when omitted; a second member with the same key returns 409. Tag
lines with its id through `dimension_ids` on a journal line, and read the income statement by it
with `live-financial-statement`'s `dimension`.

**Idempotency**: supply an `Idempotency-Key` header to make safe retries; replays within 24 hours
return the same envelope. Reusing the key with a different body returns HTTP 409 Conflict.

Args:
graph_id (str):
idempotency_key (None | str | Unset):
body (CreateDimensionRequest): Add a member to a management dimension.

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:
ErrorResponse | OperationEnvelopeDimensionResponse
"""

return sync_detailed(
graph_id=graph_id,
client=client,
body=body,
idempotency_key=idempotency_key,
).parsed


async def asyncio_detailed(
graph_id: str,
*,
client: AuthenticatedClient,
body: CreateDimensionRequest,
idempotency_key: None | str | Unset = UNSET,
) -> Response[ErrorResponse | OperationEnvelopeDimensionResponse]:
"""Create Dimension

Add a member to a management dimension: a department, class, location or project (or an axis of your
own) that ledger lines can carry, one member per axis per line. `value` is the member's stable key
within its axis, a slug of the name when omitted; a second member with the same key returns 409. Tag
lines with its id through `dimension_ids` on a journal line, and read the income statement by it
with `live-financial-statement`'s `dimension`.

**Idempotency**: supply an `Idempotency-Key` header to make safe retries; replays within 24 hours
return the same envelope. Reusing the key with a different body returns HTTP 409 Conflict.

Args:
graph_id (str):
idempotency_key (None | str | Unset):
body (CreateDimensionRequest): Add a member to a management dimension.

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[ErrorResponse | OperationEnvelopeDimensionResponse]
"""

kwargs = _get_kwargs(
graph_id=graph_id,
body=body,
idempotency_key=idempotency_key,
)

response = await client.get_async_httpx_client().request(**kwargs)

return _build_response(client=client, response=response)


async def asyncio(
graph_id: str,
*,
client: AuthenticatedClient,
body: CreateDimensionRequest,
idempotency_key: None | str | Unset = UNSET,
) -> ErrorResponse | OperationEnvelopeDimensionResponse | None:
"""Create Dimension

Add a member to a management dimension: a department, class, location or project (or an axis of your
own) that ledger lines can carry, one member per axis per line. `value` is the member's stable key
within its axis, a slug of the name when omitted; a second member with the same key returns 409. Tag
lines with its id through `dimension_ids` on a journal line, and read the income statement by it
with `live-financial-statement`'s `dimension`.

**Idempotency**: supply an `Idempotency-Key` header to make safe retries; replays within 24 hours
return the same envelope. Reusing the key with a different body returns HTTP 409 Conflict.

Args:
graph_id (str):
idempotency_key (None | str | Unset):
body (CreateDimensionRequest): Add a member to a management dimension.

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:
ErrorResponse | OperationEnvelopeDimensionResponse
"""

return (
await asyncio_detailed(
graph_id=graph_id,
client=client,
body=body,
idempotency_key=idempotency_key,
)
).parsed
Loading
Loading