{
  "$id": "https://intentschema.org/intents/productivity/contacts/contact/list/v1.json",
  "fqdn": "org.intentschema.productivity.contacts.contact.list.v1",
  "title": "List contacts",
  "description": "List the contact directory by name, email, or organization.",
  "payload": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "required": [
      "target"
    ],
    "properties": {
      "target": {
        "$ref": "https://intentschema.org/common/target/v1.json"
      },
      "object": {
        "type": "object",
        "properties": {
          "query": {
            "type": "string",
            "description": "Optional provider-specific search string."
          },
          "filter": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "email": {
                "type": "string",
                "format": "email"
              },
              "organization": {
                "type": "string"
              }
            }
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 500,
            "default": 50
          },
          "cursor": {
            "type": "string"
          }
        }
      }
    }
  },
  "result": {
    "type": "object",
    "required": [
      "items"
    ],
    "properties": {
      "items": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "given_name": {
              "type": "string"
            },
            "family_name": {
              "type": "string"
            },
            "display_name": {
              "type": "string"
            },
            "emails": {
              "type": "array",
              "items": {
                "type": "string",
                "format": "email"
              }
            },
            "phones": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "organization": {
              "type": "string"
            },
            "job_title": {
              "type": "string"
            }
          }
        }
      },
      "next_cursor": {
        "type": "string",
        "description": "Present when more results are available."
      },
      "estimated_total": {
        "type": "integer"
      }
    }
  },
  "examples": [
    {
      "name": "by email",
      "value": {
        "target": {
          "system": "google_contacts"
        },
        "object": {
          "filter": {
            "email": "jane@example.com"
          }
        }
      }
    }
  ]
}
