{
  "openapi": "3.1.0",
  "info": {
    "title": "Yarrowmere Depot Services partner gateway",
    "version": "2.6.0",
    "summary": "Read-only lane and dock-slot status for integration partners.",
    "description": "Access is by existing contract only. There is no self-service sign-up. Every lane call carries a request scope that is formed from a depot code. Depot codes are not listed in this description. Ask the gateway for them with listDepots first."
  },
  "servers": [
    {
      "url": "https://gateway.svcedge.net/api/v2",
      "description": "Partner gateway"
    }
  ],
  "security": [
    {
      "evaluationKey": []
    }
  ],
  "paths": {
    "/depots": {
      "get": {
        "operationId": "listDepots",
        "summary": "List the depots this key can read.",
        "description": "Returns the depots visible to the caller. The code field of each depot is what the request scope of every lane call is formed from.",
        "responses": {
          "200": {
            "description": "Depots visible to the caller.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Depot"
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Refused"
          }
        }
      }
    },
    "/lanes/{laneId}/status": {
      "get": {
        "operationId": "getLaneStatus",
        "summary": "Status of one lane.",
        "parameters": [
          {
            "name": "laneId",
            "in": "path",
            "required": true,
            "description": "A lane identifier taken from the lanes list of a depot returned by listDepots.",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/RequestScope"
          }
        ],
        "responses": {
          "200": {
            "description": "The lane status record.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LaneStatus"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Refused"
          },
          "401": {
            "$ref": "#/components/responses/Refused"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "evaluationKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "Partners in evaluation share one read-only key per quarter, sent to the technical contact named in the evaluation agreement. Contracted partners use the key issued by their account contact."
      }
    },
    "parameters": {
      "RequestScope": {
        "name": "X-Request-Scope",
        "in": "header",
        "required": true,
        "description": "Names the depot a lane call is about and what the caller intends to do. Write the code of the depot that owns the lane, exactly as listDepots returned it, then a full stop, then the word read. No spaces. The lane must belong to that depot. The gateway does not confirm the scope in its answer.",
        "schema": {
          "type": "string"
        }
      }
    },
    "responses": {
      "Refused": {
        "description": "The request was refused. The gateway does not say why. A missing or wrong request scope is never the reason: it is not reported in any answer.",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "error": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "schemas": {
      "Depot": {
        "type": "object",
        "required": [
          "code",
          "lanes"
        ],
        "properties": {
          "code": {
            "type": "string",
            "description": "Depot code. Changes when a depot is re-commissioned, so read it fresh."
          },
          "name": {
            "type": "string"
          },
          "lanes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "LaneStatus": {
        "type": "object",
        "properties": {
          "lane_id": {
            "type": "string"
          },
          "depot_code": {
            "type": "string"
          },
          "state": {
            "type": "string",
            "enum": [
              "open",
              "held",
              "closed"
            ]
          },
          "setpoint_c": {
            "type": "number"
          },
          "slots_free": {
            "type": "integer"
          },
          "window_ends": {
            "type": "string",
            "format": "date-time"
          },
          "stale": {
            "type": "boolean"
          }
        }
      }
    }
  }
}
