{
 "openapi": "3.1.0",
 "info": {
  "title": "Ni Biashara Directory API",
  "version": "1.1.0",
  "description": "Read-only JSON of the Ni Biashara diaspora business directory. CC BY 4.0 for curation; attribute Ni Biashara."
 },
 "servers": [
  {
   "url": "https://nibiashara.com/api/v1"
  }
 ],
 "paths": {
  "/businesses.json": {
   "get": {
    "operationId": "listBusinesses",
    "summary": "All diaspora business listings",
    "responses": {
     "200": {
      "description": "Object containing directory metadata and a businesses array",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "required": [
          "count",
          "businesses"
         ],
         "properties": {
          "version": {
           "type": "string"
          },
          "generated": {
           "type": "string"
          },
          "license": {
           "type": "object"
          },
          "source": {},
          "count": {
           "type": "integer"
          },
          "businesses": {
           "type": "array",
           "items": {
            "type": "object"
           }
          }
         }
        }
       }
      }
     }
    }
   }
  },
  "/search": {
   "get": {
    "operationId": "searchBusinesses",
    "summary": "Keyword search of listings (name, blurb, category, city, metro)",
    "parameters": [
     {
      "name": "q",
      "in": "query",
      "required": false,
      "description": "Keywords, max 8 words; all must match",
      "schema": {
       "type": "string",
       "maxLength": 100
      }
     },
     {
      "name": "city",
      "in": "query",
      "required": false,
      "description": "City or metro substring",
      "schema": {
       "type": "string",
       "maxLength": 100
      }
     },
     {
      "name": "category",
      "in": "query",
      "required": false,
      "description": "Category substring",
      "schema": {
       "type": "string",
       "maxLength": 100
      }
     },
     {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "minimum": 1,
       "maximum": 100,
       "default": 20
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Search results",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "version": {
           "type": "string"
          },
          "query": {
           "type": "object"
          },
          "total": {
           "type": "integer"
          },
          "license": {
           "type": "object"
          },
          "results": {
           "type": "array",
           "items": {
            "type": "object"
           }
          }
         }
        }
       }
      }
     },
     "400": {
      "description": "Parameter too long or too many words"
     },
     "405": {
      "description": "Method not allowed"
     }
    }
   }
  }
 }
}