{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/affiliaterail-com/json-schema/affiliaterail-com-resource-list-schema.json",
  "title": "ResourceList",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/affiliaterail-com-resources-api-openapi.yml#/components/schemas/ResourceList",
  "type": "object",
  "properties": {
    "data": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Resource"
      }
    },
    "has_more": {
      "type": "boolean",
      "description": "Pass the last object's id as `starting_after` to fetch the next page"
    },
    "total_count": {
      "type": "integer",
      "description": "Count of every object matching the filters, ignoring the cursor"
    }
  },
  "required": [
    "data",
    "has_more",
    "total_count"
  ],
  "$defs": {
    "Resource": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^(sample_)?res_",
          "description": "Prefixed id (`res_…`)"
        },
        "object": {
          "type": "string",
          "enum": [
            "resource"
          ]
        },
        "program_id": {
          "type": "string",
          "pattern": "^(sample_)?prg_",
          "description": "Prefixed id (`prg_…`)"
        },
        "kind": {
          "type": "string",
          "enum": [
            "file",
            "link"
          ]
        },
        "title": {
          "type": "string"
        },
        "url": {
          "type": "string"
        },
        "folder": {
          "type": [
            "string",
            "null"
          ]
        },
        "mime_type": {
          "type": [
            "string",
            "null"
          ]
        },
        "size_bytes": {
          "type": [
            "integer",
            "null"
          ]
        },
        "group_ids": {
          "type": "array",
          "items": {
            "type": "string",
            "pattern": "^(sample_)?grp_",
            "description": "Prefixed id (`grp_…`)"
          },
          "description": "Empty means every group sees it"
        },
        "tag_ids": {
          "type": "array",
          "items": {
            "type": "string",
            "pattern": "^(sample_)?tag_",
            "description": "Prefixed id (`tag_…`)"
          }
        },
        "position": {
          "type": "integer"
        },
        "published": {
          "type": "boolean"
        },
        "published_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time",
          "description": "ISO-8601, UTC"
        },
        "metadata": {
          "type": [
            "object",
            "null"
          ],
          "additionalProperties": {},
          "description": "Your own key/value data, stored as given"
        },
        "created_at": {
          "type": "string",
          "format": "date-time",
          "description": "ISO-8601, UTC"
        },
        "updated_at": {
          "type": "string",
          "format": "date-time",
          "description": "ISO-8601, UTC"
        }
      },
      "required": [
        "id",
        "object",
        "program_id",
        "kind",
        "title",
        "url",
        "folder",
        "mime_type",
        "size_bytes",
        "group_ids",
        "tag_ids",
        "position",
        "published",
        "published_at",
        "metadata",
        "created_at",
        "updated_at"
      ]
    }
  }
}