Skip to content

responses

Pydantic models/schemas for the API responses.

DatabasesResponse

Bases: EntryResponseMany

Successful response for GET /databases

This model is essentially equal to LinksResponse with the exception of the data field's description.

Source code in optimade_gateway/models/responses.py
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
class DatabasesResponse(EntryResponseMany):
    """Successful response for `GET /databases`

    This model is essentially equal to
    [`LinksResponse`](https://www.optimade.org/optimade-python-tools/api_reference/models/responses/#optimade.models.responses.LinksResponse)
    with the exception of the `data` field's description.
    """

    data: Annotated[
        list[LinksResource],
        StrictField(
            description=(
                "List of unique OPTIMADE links resource objects.\nThese links resource "
                "objects represents OPTIMADE databases that can be used for queries in "
                "gateways."
            ),
            uniqueItems=True,
        ),
    ]

data: Annotated[list[LinksResource], StrictField(description='List of unique OPTIMADE links resource objects.\nThese links resource objects represents OPTIMADE databases that can be used for queries in gateways.', uniqueItems=True)] instance-attribute

DatabasesResponseSingle

Bases: EntryResponseOne

Successful response for POST /databases and GET /databases/{database_id}

Source code in optimade_gateway/models/responses.py
36
37
38
39
40
41
42
43
44
45
46
47
48
49
class DatabasesResponseSingle(EntryResponseOne):
    """Successful response for `POST /databases` and `GET /databases/{database_id}`"""

    data: Annotated[
        LinksResource | None,
        Field(
            description=(
                "A unique OPTIMADE links resource object.\nThe OPTIMADE links resource "
                "object has just been created or found according to the specific query "
                "parameter(s) or URL id.\nIt represents an OPTIMADE database that can "
                "be used for queries in gateways."
            ),
        ),
    ]

data: Annotated[LinksResource | None, Field(description='A unique OPTIMADE links resource object.\nThe OPTIMADE links resource object has just been created or found according to the specific query parameter(s) or URL id.\nIt represents an OPTIMADE database that can be used for queries in gateways.')] instance-attribute

GatewaysResponse

Bases: EntryResponseMany

Successful response for GET /gateways

Source code in optimade_gateway/models/responses.py
52
53
54
55
56
57
58
59
60
61
class GatewaysResponse(EntryResponseMany):
    """Successful response for `GET /gateways`"""

    data: Annotated[
        list[GatewayResource],
        StrictField(
            description="List of unique OPTIMADE gateway resource objects.",
            uniqueItems=True,
        ),
    ]

data: Annotated[list[GatewayResource], StrictField(description='List of unique OPTIMADE gateway resource objects.', uniqueItems=True)] instance-attribute

GatewaysResponseSingle

Bases: EntryResponseOne

Successful response for POST /gateways and GET /gateways/{gateway_id}.

Source code in optimade_gateway/models/responses.py
64
65
66
67
68
69
70
71
72
73
74
75
76
class GatewaysResponseSingle(EntryResponseOne):
    """Successful response for `POST /gateways` and `GET /gateways/{gateway_id}`."""

    data: Annotated[
        GatewayResource | None,
        Field(
            description=(
                "A unique OPTIMADE gateway resource object.\nThe OPTIMADE gateway "
                "resource object has just been created or found according to the "
                "specific query parameter(s) or URL id."
            ),
        ),
    ]

data: Annotated[GatewayResource | None, Field(description='A unique OPTIMADE gateway resource object.\nThe OPTIMADE gateway resource object has just been created or found according to the specific query parameter(s) or URL id.')] instance-attribute

QueriesResponse

Bases: EntryResponseMany

Successful response for GET /gateways/{gateway_ID}/queries.

Source code in optimade_gateway/models/responses.py
79
80
81
82
83
84
85
86
87
88
class QueriesResponse(EntryResponseMany):
    """Successful response for `GET /gateways/{gateway_ID}/queries`."""

    data: Annotated[
        list[QueryResource],
        StrictField(
            description="List of unique OPTIMADE gateway query resource objects.",
            uniqueItems=True,
        ),
    ]

data: Annotated[list[QueryResource], StrictField(description='List of unique OPTIMADE gateway query resource objects.', uniqueItems=True)] instance-attribute

QueriesResponseSingle

Bases: EntryResponseOne

Successful response for POST /gateways/{gateway_ID}/queries and GET /gateways/{gateway_ID}/queries/{query_id}.

Source code in optimade_gateway/models/responses.py
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
class QueriesResponseSingle(EntryResponseOne):
    """Successful response for `POST /gateways/{gateway_ID}/queries`
    and `GET /gateways/{gateway_ID}/queries/{query_id}`."""

    data: Annotated[
        QueryResource | None,
        Field(
            description=(
                "A unique OPTIMADE gateway query resource object.\nThe OPTIMADE "
                "gateway query resource object has just been created or found "
                "according to the specific query parameter(s) or URL id."
            ),
        ),
    ]

data: Annotated[QueryResource | None, Field(description='A unique OPTIMADE gateway query resource object.\nThe OPTIMADE gateway query resource object has just been created or found according to the specific query parameter(s) or URL id.')] instance-attribute