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
16 changes: 12 additions & 4 deletions robosystems_client/api/connections/create_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ def sync_detailed(
"""Create Connection

SEC: provide entity CIK, no auth needed. QuickBooks: returns an OAuth URL — complete the flow to
activate. One connection allowed per provider per graph.
activate. External: registers a source namespace for an integration that writes through the public
API. One connection allowed per provider per graph, except 'external' which allows one per
source_name.

Args:
graph_id (str):
Expand Down Expand Up @@ -143,7 +145,9 @@ def sync(
"""Create Connection

SEC: provide entity CIK, no auth needed. QuickBooks: returns an OAuth URL — complete the flow to
activate. One connection allowed per provider per graph.
activate. External: registers a source namespace for an integration that writes through the public
API. One connection allowed per provider per graph, except 'external' which allows one per
source_name.

Args:
graph_id (str):
Expand Down Expand Up @@ -173,7 +177,9 @@ async def asyncio_detailed(
"""Create Connection

SEC: provide entity CIK, no auth needed. QuickBooks: returns an OAuth URL — complete the flow to
activate. One connection allowed per provider per graph.
activate. External: registers a source namespace for an integration that writes through the public
API. One connection allowed per provider per graph, except 'external' which allows one per
source_name.

Args:
graph_id (str):
Expand Down Expand Up @@ -206,7 +212,9 @@ async def asyncio(
"""Create Connection

SEC: provide entity CIK, no auth needed. QuickBooks: returns an OAuth URL — complete the flow to
activate. One connection allowed per provider per graph.
activate. External: registers a source namespace for an integration that writes through the public
API. One connection allowed per provider per graph, except 'external' which allows one per
source_name.

Args:
graph_id (str):
Expand Down
322 changes: 322 additions & 0 deletions robosystems_client/api/extensions_robo_ledger/assert_metrics.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,322 @@
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.assert_metrics_request import AssertMetricsRequest
from ...models.error_response import ErrorResponse
from ...models.operation_envelope_assert_metrics_response import (
OperationEnvelopeAssertMetricsResponse,
)
from ...types import UNSET, Response, Unset


def _get_kwargs(
graph_id: str,
*,
body: AssertMetricsRequest,
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/assert-metrics".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 | OperationEnvelopeAssertMetricsResponse | None:
if response.status_code == 200:
response_200 = OperationEnvelopeAssertMetricsResponse.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 | OperationEnvelopeAssertMetricsResponse]:
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: AssertMetricsRequest,
idempotency_key: None | str | Unset = UNSET,
) -> Response[ErrorResponse | OperationEnvelopeAssertMetricsResponse]:
"""Assert Metrics for a Metric Block

Writes externally-observed metric values (usage counts, marketing numbers, hand-carried figures)
into the period's standing factset_type='metric' FactSet with AssertedProvenance — the observation
sibling of compute-metrics. One standing FactSet per (structure, entity, period_end); re-asserting a
period replaces its facts. Structures carrying Derive rules are compute-owned and rejected: asserted
and derived metric series keep disjoint structures. Observations must resolve to concepts on the
structure's presentation catalog. Deterministic and non-AI — no credits consumed.

**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 (AssertMetricsRequest): Request body for the ``assert-metrics`` operation.

The observation sibling of ``compute-metrics``: writes externally-
observed values (usage counts, marketing numbers, hand-carried
figures) into the period's standing ``factset_type='metric'`` FactSet
with ``AssertedProvenance``. Re-asserting a period replaces its facts
— one standing FactSet per (structure, entity, period_end), the
accumulating time series.

Structures carrying ``Derive`` rules are compute-owned
(``compute-metrics``) and rejected — asserted and derived metric
series keep disjoint structures. Asserted series are actuals; there
is no scenario axis.

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 | OperationEnvelopeAssertMetricsResponse]
"""

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: AssertMetricsRequest,
idempotency_key: None | str | Unset = UNSET,
) -> ErrorResponse | OperationEnvelopeAssertMetricsResponse | None:
"""Assert Metrics for a Metric Block

Writes externally-observed metric values (usage counts, marketing numbers, hand-carried figures)
into the period's standing factset_type='metric' FactSet with AssertedProvenance — the observation
sibling of compute-metrics. One standing FactSet per (structure, entity, period_end); re-asserting a
period replaces its facts. Structures carrying Derive rules are compute-owned and rejected: asserted
and derived metric series keep disjoint structures. Observations must resolve to concepts on the
structure's presentation catalog. Deterministic and non-AI — no credits consumed.

**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 (AssertMetricsRequest): Request body for the ``assert-metrics`` operation.

The observation sibling of ``compute-metrics``: writes externally-
observed values (usage counts, marketing numbers, hand-carried
figures) into the period's standing ``factset_type='metric'`` FactSet
with ``AssertedProvenance``. Re-asserting a period replaces its facts
— one standing FactSet per (structure, entity, period_end), the
accumulating time series.

Structures carrying ``Derive`` rules are compute-owned
(``compute-metrics``) and rejected — asserted and derived metric
series keep disjoint structures. Asserted series are actuals; there
is no scenario axis.

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 | OperationEnvelopeAssertMetricsResponse
"""

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: AssertMetricsRequest,
idempotency_key: None | str | Unset = UNSET,
) -> Response[ErrorResponse | OperationEnvelopeAssertMetricsResponse]:
"""Assert Metrics for a Metric Block

Writes externally-observed metric values (usage counts, marketing numbers, hand-carried figures)
into the period's standing factset_type='metric' FactSet with AssertedProvenance — the observation
sibling of compute-metrics. One standing FactSet per (structure, entity, period_end); re-asserting a
period replaces its facts. Structures carrying Derive rules are compute-owned and rejected: asserted
and derived metric series keep disjoint structures. Observations must resolve to concepts on the
structure's presentation catalog. Deterministic and non-AI — no credits consumed.

**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 (AssertMetricsRequest): Request body for the ``assert-metrics`` operation.

The observation sibling of ``compute-metrics``: writes externally-
observed values (usage counts, marketing numbers, hand-carried
figures) into the period's standing ``factset_type='metric'`` FactSet
with ``AssertedProvenance``. Re-asserting a period replaces its facts
— one standing FactSet per (structure, entity, period_end), the
accumulating time series.

Structures carrying ``Derive`` rules are compute-owned
(``compute-metrics``) and rejected — asserted and derived metric
series keep disjoint structures. Asserted series are actuals; there
is no scenario axis.

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 | OperationEnvelopeAssertMetricsResponse]
"""

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: AssertMetricsRequest,
idempotency_key: None | str | Unset = UNSET,
) -> ErrorResponse | OperationEnvelopeAssertMetricsResponse | None:
"""Assert Metrics for a Metric Block

Writes externally-observed metric values (usage counts, marketing numbers, hand-carried figures)
into the period's standing factset_type='metric' FactSet with AssertedProvenance — the observation
sibling of compute-metrics. One standing FactSet per (structure, entity, period_end); re-asserting a
period replaces its facts. Structures carrying Derive rules are compute-owned and rejected: asserted
and derived metric series keep disjoint structures. Observations must resolve to concepts on the
structure's presentation catalog. Deterministic and non-AI — no credits consumed.

**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 (AssertMetricsRequest): Request body for the ``assert-metrics`` operation.

The observation sibling of ``compute-metrics``: writes externally-
observed values (usage counts, marketing numbers, hand-carried
figures) into the period's standing ``factset_type='metric'`` FactSet
with ``AssertedProvenance``. Re-asserting a period replaces its facts
— one standing FactSet per (structure, entity, period_end), the
accumulating time series.

Structures carrying ``Derive`` rules are compute-owned
(``compute-metrics``) and rejected — asserted and derived metric
series keep disjoint structures. Asserted series are actuals; there
is no scenario axis.

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 | OperationEnvelopeAssertMetricsResponse
"""

return (
await asyncio_detailed(
graph_id=graph_id,
client=client,
body=body,
idempotency_key=idempotency_key,
)
).parsed
2 changes: 1 addition & 1 deletion robosystems_client/graphql/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ type Query {
statement(reportId: String!, blockType: String!): Statement
publishLists(limit: Int = null, offset: Int = null): PublishListList
publishList(listId: String!): PublishListDetail
informationBlock(id: ID!, scenarioId: String = null, series: Boolean! = false, seriesHistory: Int = null, seriesForecast: Int = null): InformationBlock
informationBlock(id: ID!, scenarioId: String = null, series: Boolean = null, seriesHistory: Int = null, seriesForecast: Int = null): InformationBlock
informationBlocks(blockType: String = null, category: String = null, limit: Int = null, offset: Int = null, scenarioId: String = null): [InformationBlock!]!
taxonomyBlock(id: ID!): TaxonomyBlock
taxonomyBlocks(taxonomyType: String = null, parentTaxonomyId: ID = null, category: String = null, limit: Int = null, offset: Int = null): [TaxonomyBlock!]!
Expand Down
Loading