|
| 1 | +from __future__ import annotations |
| 2 | + |
| 3 | +import datetime |
| 4 | +from typing import Any |
| 5 | + |
| 6 | +from geojson_pydantic.geometries import Geometry |
| 7 | +from pydantic import BaseModel |
| 8 | + |
| 9 | + |
| 10 | +class CreateOrder(BaseModel): |
| 11 | + """A request for the provider to collect or otherwise gather data.""" |
| 12 | + |
| 13 | + datetime: str |
| 14 | + """Time interval with a solidus (forward slash, /) separator, using RFC 3339 datetime, empty string, or .. values.""" |
| 15 | + |
| 16 | + productId: str |
| 17 | + """Product identifier. |
| 18 | + |
| 19 | + The ID should be unique and is a reference to the parameters which can be used in the parameters field.""" |
| 20 | + |
| 21 | + geometry: Geometry |
| 22 | + """Provide a Geometry that the tasked data must be within.""" |
| 23 | + |
| 24 | + filter: dict[str, Any] | None = None |
| 25 | + """A set of additional parameters in CQL2 JSON based on the parameters exposed in the product.""" |
| 26 | + |
| 27 | + |
| 28 | +class Order(BaseModel): |
| 29 | + """An order""" |
| 30 | + |
| 31 | + id: str |
| 32 | + """Unique provider generated order ID""" |
| 33 | + |
| 34 | + user: str |
| 35 | + """User or organization ID ?""" |
| 36 | + |
| 37 | + created: datetime.datetime |
| 38 | + """When the order was created""" |
| 39 | + |
| 40 | + status: Status |
| 41 | + """Current Order Status object""" |
| 42 | + |
| 43 | + links: list[Link] = [] |
| 44 | + """Links will be very provider specific.""" |
| 45 | + |
| 46 | + |
| 47 | +class Status(BaseModel): |
| 48 | + """Order status""" |
| 49 | + |
| 50 | + timestamp: datetime.datetime |
| 51 | + """ISO 8601 timestamp for the order status""" |
| 52 | + |
| 53 | + status_code: str |
| 54 | + """Enumerated status code""" |
| 55 | + |
| 56 | + reason_code: str | None = None |
| 57 | + """Enumerated reason code for why the status was set""" |
| 58 | + |
| 59 | + reason_text: str | None = None |
| 60 | + """Textual description for why the status was set""" |
| 61 | + |
| 62 | + links: list[Link] = [] |
| 63 | + """List of references to documents, such as delivered asset, processing log, delivery manifest, etc.""" |
| 64 | + |
| 65 | + |
| 66 | +class Link(BaseModel): |
| 67 | + """Links will be very provider specific.""" |
| 68 | + |
| 69 | + href: str |
| 70 | + """The actual link in the format of an URL. |
| 71 | + |
| 72 | + Relative and absolute links are both allowed. Trailing slashes are significant.""" |
| 73 | + |
| 74 | + rel: str |
| 75 | + """Relationship between the current document and the linked document. |
| 76 | + |
| 77 | + See chapter "Relation types" for more information.""" |
| 78 | + |
| 79 | + type: str | None = None |
| 80 | + """Media type of the referenced entity.""" |
| 81 | + |
| 82 | + title: str | None = None |
| 83 | + """A human readable title to be used in rendered displays of the link.""" |
| 84 | + |
| 85 | + method: str | None = None |
| 86 | + """The HTTP method that shall be used for the request to the target resource, in uppercase. |
| 87 | + |
| 88 | + GET by default""" |
| 89 | + |
| 90 | + headers: dict[str, str | list[str]] | None = None |
| 91 | + """The HTTP headers to be sent for the request to the target resource.""" |
0 commit comments