SerenAI

Pay Per Call Agentic Commerce

DataResponse_Vec_Plan

Generic API response wrapper with optional pagination This wrapper provides a consistent structure for all API responses, making it easier for clients to handle responses uniformly. It supports both single resources and collections, with optional pagination metadata. # Response Structure ```json { "data": T, "pagination": { ... } // optional } ``` # Examples ## Single Resource ```rust use seren_core::http::DataResponse; use serde::Serialize; #[derive(Serialize)] struct Project { id: String, name: String, } let project = Project { id: "123".to_string(), name: "My Project".to_string(), }; let response = DataResponse::new(project); // Serializes to: {"data": {"id": "123", "name": "My Project"}} ``` ## Collection with Pagination ```rust use seren_core::http::DataResponse; use seren_core::pagination::PaginationMeta; use serde::Serialize; #[derive(Serialize)] struct Project { id: String, name: String, } let projects: Vec<Project> = Vec::new(); let pagination = PaginationMeta { total: 0, count: 0, limit: 20, offset: 0, has_more: false, }; let response = DataResponse::with_pagination(projects, pagination); // Serializes to: {"data": [...], "pagination": {"total": 0, "count": 0, "limit": 20, "offset": 0, "has_more": false}} ```

Properties

PropertyTypeRequiredDescription
data Array<object> Yes
pagination any No
View JSON Schema
{
  "type": "object",
  "description": "Generic API response wrapper with optional pagination\n\nThis wrapper provides a consistent structure for all API responses,\nmaking it easier for clients to handle responses uniformly. It supports\nboth single resources and collections, with optional pagination metadata.\n\n# Response Structure\n\n```json\n{\n  \"data\": T,\n  \"pagination\": { ... } // optional\n}\n```\n\n# Examples\n\n## Single Resource\n\n```rust\nuse seren_core::http::DataResponse;\nuse serde::Serialize;\n\n#[derive(Serialize)]\nstruct Project {\n    id: String,\n    name: String,\n}\n\nlet project = Project {\n    id: \"123\".to_string(),\n    name: \"My Project\".to_string(),\n};\n\nlet response = DataResponse::new(project);\n// Serializes to: {\"data\": {\"id\": \"123\", \"name\": \"My Project\"}}\n```\n\n## Collection with Pagination\n\n```rust\nuse seren_core::http::DataResponse;\nuse seren_core::pagination::PaginationMeta;\nuse serde::Serialize;\n\n#[derive(Serialize)]\nstruct Project {\n    id: String,\n    name: String,\n}\n\nlet projects: Vec<Project> = Vec::new();\nlet pagination = PaginationMeta {\n    total: 0,\n    count: 0,\n    limit: 20,\n    offset: 0,\n    has_more: false,\n};\n\nlet response = DataResponse::with_pagination(projects, pagination);\n// Serializes to: {\"data\": [...], \"pagination\": {\"total\": 0, \"count\": 0, \"limit\": 20, \"offset\": 0, \"has_more\": false}}\n```",
  "required": [
    "data"
  ],
  "properties": {
    "data": {
      "type": "array",
      "items": {
        "type": "object",
        "description": "Plan represents a subscription tier (Free, Launch, Scale)",
        "required": [
          "id",
          "name",
          "display_name",
          "price_monthly",
          "max_compute_units",
          "max_branches_per_project",
          "support_level",
          "ip_allowlist_enabled",
          "vpc_enabled",
          "sso_enabled",
          "audit_logs_enabled",
          "monitoring_enabled",
          "is_active",
          "sort_order",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "audit_logs_enabled": {
            "type": "boolean"
          },
          "branch_price_per_hour": {
            "type": [
              "string",
              "null"
            ]
          },
          "compute_hours_quota": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32"
          },
          "compute_price_per_cu_hour": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "data_transfer_gb_included": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32"
          },
          "data_transfer_price_per_gb": {
            "type": [
              "string",
              "null"
            ]
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "display_name": {
            "type": "string"
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "ip_allowlist_enabled": {
            "type": "boolean"
          },
          "is_active": {
            "type": "boolean"
          },
          "max_branches_per_project": {
            "type": "integer",
            "format": "int32"
          },
          "max_compute_units": {
            "type": "integer",
            "format": "int32"
          },
          "max_databases_per_branch": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32"
          },
          "max_endpoints_per_branch": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32"
          },
          "max_projects": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32"
          },
          "monitoring_enabled": {
            "type": "boolean"
          },
          "monitoring_retention_days": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32"
          },
          "name": {
            "type": "string"
          },
          "pitr_price_per_gb_month": {
            "type": [
              "string",
              "null"
            ]
          },
          "pitr_retention_hours": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32"
          },
          "price_monthly": {
            "type": "string"
          },
          "scale_to_zero_delay_seconds": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32"
          },
          "sla_uptime_percent": {
            "type": [
              "string",
              "null"
            ]
          },
          "sort_order": {
            "type": "integer",
            "format": "int32"
          },
          "sso_enabled": {
            "type": "boolean"
          },
          "storage_gb_quota": {
            "type": [
              "string",
              "null"
            ]
          },
          "storage_price_per_gb_month": {
            "type": [
              "string",
              "null"
            ]
          },
          "stripe_price_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Stripe Price ID used for recurring subscriptions on this plan (for paid tiers)."
          },
          "support_level": {
            "type": "string"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "vpc_enabled": {
            "type": "boolean"
          }
        }
      }
    },
    "pagination": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/PaginationMeta",
          "description": "Optional pagination metadata"
        }
      ]
    }
  }
}