Files
next-tjwater-agent/openapi/openapi.json
T

704 lines
16 KiB
JSON

{
"openapi": "3.1.0",
"info": {
"title": "Next TJWater Data API",
"version": "0.1.0"
},
"paths": {
"/api/v1/projects": {
"get": {
"tags": [
"projects"
],
"summary": "Projects",
"operationId": "projects_api_v1_projects_get",
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"items": {
"$ref": "#/components/schemas/ProjectResponse"
},
"type": "array",
"title": "Response Projects Api V1 Projects Get"
}
}
}
}
},
"security": [
{
"OAuth2PasswordBearer": []
}
]
}
},
"/api/v1/scada/assets": {
"get": {
"tags": [
"scada"
],
"summary": "Assets",
"operationId": "assets_api_v1_scada_assets_get",
"security": [
{
"OAuth2PasswordBearer": []
}
],
"parameters": [
{
"name": "X-Project-Id",
"in": "header",
"required": false,
"schema": {
"anyOf": [
{
"type": "string",
"format": "uuid"
},
{
"type": "null"
}
],
"title": "X-Project-Id"
}
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ScadaAssetsResponse"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/api/v1/scada/readings/query": {
"post": {
"tags": [
"scada"
],
"summary": "Readings",
"operationId": "readings_api_v1_scada_readings_query_post",
"security": [
{
"OAuth2PasswordBearer": []
}
],
"parameters": [
{
"name": "X-Project-Id",
"in": "header",
"required": false,
"schema": {
"anyOf": [
{
"type": "string",
"format": "uuid"
},
{
"type": "null"
}
],
"title": "X-Project-Id"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ScadaReadingQuery"
}
}
}
},
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ScadaReadingQueryResponse"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/api/v1/geocode": {
"post": {
"tags": [
"geocode"
],
"summary": "Geocode",
"operationId": "geocode_api_v1_geocode_post",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/GeocodeRequest"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/GeocodeResponse"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
},
"security": [
{
"OAuth2PasswordBearer": []
}
]
}
},
"/health/live": {
"get": {
"summary": "Live",
"operationId": "live_health_live_get",
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"additionalProperties": {
"type": "string"
},
"type": "object",
"title": "Response Live Health Live Get"
}
}
}
}
}
}
},
"/health/ready": {
"get": {
"summary": "Ready",
"operationId": "ready_health_ready_get",
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"additionalProperties": {
"type": "string"
},
"type": "object",
"title": "Response Ready Health Ready Get"
}
}
}
}
}
}
}
},
"components": {
"schemas": {
"GeocodeLocation": {
"properties": {
"lon": {
"type": "number",
"title": "Lon"
},
"lat": {
"type": "number",
"title": "Lat"
},
"level": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Level"
},
"score": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "Score"
},
"keyWord": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Keyword"
}
},
"type": "object",
"required": [
"lon",
"lat"
],
"title": "GeocodeLocation"
},
"GeocodeRequest": {
"properties": {
"keyword": {
"type": "string",
"maxLength": 200,
"minLength": 1,
"title": "Keyword"
}
},
"type": "object",
"required": [
"keyword"
],
"title": "GeocodeRequest"
},
"GeocodeResponse": {
"properties": {
"status": {
"anyOf": [
{
"type": "string"
},
{
"type": "integer"
}
],
"title": "Status"
},
"msg": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Msg"
},
"location": {
"anyOf": [
{
"$ref": "#/components/schemas/GeocodeLocation"
},
{
"type": "null"
}
]
},
"searchVersion": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Searchversion"
}
},
"type": "object",
"required": [
"status"
],
"title": "GeocodeResponse"
},
"HTTPValidationError": {
"properties": {
"detail": {
"items": {
"$ref": "#/components/schemas/ValidationError"
},
"type": "array",
"title": "Detail"
}
},
"type": "object",
"title": "HTTPValidationError"
},
"MapExtent": {
"properties": {
"xmin": {
"type": "number",
"title": "Xmin"
},
"ymin": {
"type": "number",
"title": "Ymin"
},
"xmax": {
"type": "number",
"title": "Xmax"
},
"ymax": {
"type": "number",
"title": "Ymax"
}
},
"type": "object",
"required": [
"xmin",
"ymin",
"xmax",
"ymax"
],
"title": "MapExtent"
},
"ProjectResponse": {
"properties": {
"project_id": {
"type": "string",
"format": "uuid",
"title": "Project Id"
},
"code": {
"type": "string",
"title": "Code"
},
"name": {
"type": "string",
"title": "Name"
},
"description": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Description"
},
"status": {
"type": "string",
"enum": [
"active",
"inactive"
],
"title": "Status"
},
"project_role": {
"type": "string",
"title": "Project Role"
},
"gs_workspace": {
"type": "string",
"title": "Gs Workspace"
},
"map_extent": {
"anyOf": [
{
"$ref": "#/components/schemas/MapExtent"
},
{
"type": "null"
}
]
}
},
"type": "object",
"required": [
"project_id",
"code",
"name",
"description",
"status",
"project_role",
"gs_workspace",
"map_extent"
],
"title": "ProjectResponse"
},
"ScadaAssetOut": {
"properties": {
"scada_id": {
"type": "string",
"format": "uuid",
"title": "Scada Id"
},
"external_id": {
"type": "string",
"title": "External Id"
},
"site_external_id": {
"type": "string",
"title": "Site External Id"
},
"name": {
"type": "string",
"title": "Name"
},
"kind": {
"type": "string",
"enum": [
"water_quality",
"radar_level",
"ultrasonic_flow"
],
"title": "Kind"
},
"active": {
"type": "boolean",
"title": "Active"
}
},
"type": "object",
"required": [
"scada_id",
"external_id",
"site_external_id",
"name",
"kind",
"active"
],
"title": "ScadaAssetOut"
},
"ScadaAssetsResponse": {
"properties": {
"assets": {
"items": {
"$ref": "#/components/schemas/ScadaAssetOut"
},
"type": "array",
"title": "Assets"
}
},
"type": "object",
"required": [
"assets"
],
"title": "ScadaAssetsResponse"
},
"ScadaReadingQuery": {
"properties": {
"asset_ids": {
"items": {
"type": "string",
"format": "uuid"
},
"type": "array",
"maxItems": 100,
"minItems": 1,
"title": "Asset Ids"
},
"observed_from": {
"type": "string",
"format": "date-time",
"title": "Observed From"
},
"observed_to": {
"type": "string",
"format": "date-time",
"title": "Observed To"
},
"granularity": {
"type": "string",
"enum": [
"5m",
"1h",
"1d"
],
"title": "Granularity",
"default": "5m"
},
"metrics": {
"items": {
"type": "string",
"enum": [
"conductivity_mean",
"level_mean",
"flow_mean",
"temperature_mean"
]
},
"type": "array",
"maxItems": 4,
"minItems": 1,
"title": "Metrics"
}
},
"type": "object",
"required": [
"asset_ids",
"observed_from",
"observed_to",
"metrics"
],
"title": "ScadaReadingQuery"
},
"ScadaReadingQueryResponse": {
"properties": {
"data": {
"items": {
"$ref": "#/components/schemas/ScadaReadingRow"
},
"type": "array",
"title": "Data"
},
"meta": {
"additionalProperties": true,
"type": "object",
"title": "Meta"
}
},
"type": "object",
"required": [
"data",
"meta"
],
"title": "ScadaReadingQueryResponse"
},
"ScadaReadingRow": {
"properties": {
"asset_id": {
"type": "string",
"format": "uuid",
"title": "Asset Id"
},
"observed_at": {
"type": "string",
"format": "date-time",
"title": "Observed At"
},
"values": {
"additionalProperties": {
"anyOf": [
{
"type": "number"
},
{
"type": "null"
}
]
},
"type": "object",
"title": "Values"
}
},
"type": "object",
"required": [
"asset_id",
"observed_at",
"values"
],
"title": "ScadaReadingRow"
},
"ValidationError": {
"properties": {
"loc": {
"items": {
"anyOf": [
{
"type": "string"
},
{
"type": "integer"
}
]
},
"type": "array",
"title": "Location"
},
"msg": {
"type": "string",
"title": "Message"
},
"type": {
"type": "string",
"title": "Error Type"
},
"input": {
"title": "Input"
},
"ctx": {
"type": "object",
"title": "Context"
}
},
"type": "object",
"required": [
"loc",
"msg",
"type"
],
"title": "ValidationError"
}
},
"securitySchemes": {
"OAuth2PasswordBearer": {
"type": "oauth2",
"flows": {
"password": {
"scopes": {},
"tokenUrl": "unused"
}
}
}
}
}
}