Documentation
Document APIs with descriptions, examples, formats, and deprecation notices at every level
API Definition
config/apis/brave_eagle.rb
rb
# frozen_string_literal: true
Apiwork::API.define '/brave_eagle' do
key_format :camel
export :openapi
export :apiwork
info do
title 'Task Management API'
version '1.0.0'
description 'API for managing tasks and projects'
contact do
name 'API Support'
email 'support@example.com'
end
license do
name 'MIT'
url 'https://opensource.org/licenses/MIT'
end
end
resources :tasks do
member do
patch :archive
end
end
endModels
app/models/brave_eagle/task.rb
rb
# frozen_string_literal: true
module BraveEagle
class Task < ApplicationRecord
belongs_to :assignee, class_name: 'User', inverse_of: :assigned_tasks, optional: true
has_many :comments, dependent: :destroy
validates :title, presence: true
def archive!
update!(archived: true)
end
end
endDatabase Table
| Column | Type | Nullable | Default |
|---|---|---|---|
| id | string | ||
| archived | boolean | ✓ | |
| assignee_id | string | ✓ | |
| created_at | datetime | ||
| description | text | ✓ | |
| due_date | datetime | ✓ | |
| priority | string | ✓ | medium |
| status | string | ✓ | pending |
| title | string | ||
| updated_at | datetime |
app/models/brave_eagle/user.rb
rb
# frozen_string_literal: true
module BraveEagle
class User < ApplicationRecord
has_many :assigned_tasks, class_name: 'Task', dependent: :nullify, foreign_key: :assignee_id, inverse_of: :assignee
end
endDatabase Table
| Column | Type | Nullable | Default |
|---|---|---|---|
| id | string | ||
| created_at | datetime | ||
| string | |||
| name | string | ||
| updated_at | datetime |
app/models/brave_eagle/comment.rb
rb
# frozen_string_literal: true
module BraveEagle
class Comment < ApplicationRecord
belongs_to :task
end
endDatabase Table
| Column | Type | Nullable | Default |
|---|---|---|---|
| id | string | ||
| author_name | string | ✓ | |
| body | text | ||
| created_at | datetime | ||
| task_id | string | ||
| updated_at | datetime |
Representations
app/representations/brave_eagle/task_representation.rb
rb
# frozen_string_literal: true
module BraveEagle
class TaskRepresentation < Apiwork::Representation::Base
description 'A task representing work to be completed'
attribute :id, description: 'Unique task identifier'
attribute :title, description: 'Short title describing the task', example: 'Implement user authentication', writable: true
attribute :description,
description: 'Detailed description of what needs to be done',
example: 'Add OAuth2 login support for Google and GitHub providers',
writable: true
attribute :status,
description: 'Current status of the task',
enum: %w[pending in_progress completed archived],
example: 'pending',
filterable: true,
writable: true
attribute :priority,
description: 'Priority level for task ordering',
enum: %w[low medium high critical],
example: 'high',
filterable: true,
writable: true
attribute :due_date, description: 'Target date for task completion', example: '2024-02-01T00:00:00Z', sortable: true, writable: true
attribute :archived, deprecated: true, description: 'Whether the task has been archived'
attribute :created_at, description: 'Timestamp when the task was created', sortable: true
attribute :updated_at, description: 'Timestamp of last modification', sortable: true
belongs_to :assignee, description: 'User responsible for completing this task'
has_many :comments, description: 'Discussion comments on this task'
end
endapp/representations/brave_eagle/user_representation.rb
rb
# frozen_string_literal: true
module BraveEagle
class UserRepresentation < Apiwork::Representation::Base
description 'A user who can be assigned to tasks'
attribute :id, description: 'Unique user identifier'
attribute :name, description: "User's display name", example: 'Jane Doe'
attribute :email, description: "User's email address", example: 'jane@example.com', format: :email
end
endapp/representations/brave_eagle/comment_representation.rb
rb
# frozen_string_literal: true
module BraveEagle
class CommentRepresentation < Apiwork::Representation::Base
description 'A comment on a task'
attribute :id, description: 'Unique comment identifier'
attribute :body, description: 'Comment content', example: 'This looks good, ready for review.', writable: true
attribute :author_name, description: 'Name of the person who wrote the comment', example: 'John Doe', writable: true
attribute :created_at, description: 'When the comment was created'
attribute :updated_at, description: 'When the comment was last updated'
end
endContracts
app/contracts/brave_eagle/task_contract.rb
rb
# frozen_string_literal: true
module BraveEagle
class TaskContract < Apiwork::Contract::Base
representation TaskRepresentation
action :index do
summary 'List all tasks'
description 'Returns a paginated list of tasks with optional filtering by status and priority'
tags 'Tasks', 'Core'
operation_id 'listTasks'
end
action :show do
summary 'Get task details'
description 'Returns a single task by ID'
tags 'Tasks'
operation_id 'getTask'
response do
description 'The task'
end
end
action :create do
summary 'Create a new task'
description 'Creates a task and returns the created resource'
tags 'Tasks'
operation_id 'createTask'
request do
description 'The task to create'
end
end
action :update do
summary 'Update a task'
description 'Updates an existing task'
tags 'Tasks'
operation_id 'updateTask'
end
action :destroy do
summary 'Delete a task'
description 'Permanently removes a task'
tags 'Tasks'
operation_id 'deleteTask'
end
action :archive do
summary 'Archive a task'
description 'Marks a task as archived. Archived tasks are hidden from default listings but can still be retrieved.'
tags 'Tasks', 'Lifecycle'
operation_id 'archiveTask'
deprecated!
end
end
endControllers
app/controllers/brave_eagle/tasks_controller.rb
rb
# frozen_string_literal: true
module BraveEagle
class TasksController < ApplicationController
before_action :set_task, only: %i[show update destroy archive]
def index
tasks = Task.all
expose tasks
end
def show
expose task
end
def create
task = Task.create(contract.body[:task])
expose task
end
def update
task.update(contract.body[:task])
expose task
end
def destroy
task.destroy
expose task
end
def archive
task.archive!
expose task
end
private
attr_reader :task
def set_task
@task = Task.find(params[:id])
end
end
endRequest Examples
List all tasks
Request
http
GET /brave_eagle/tasksResponse 200
json
{
"tasks": [
{
"id": "0ec28309-26a2-5f19-92c0-3b60b8796f2e",
"title": "Write documentation",
"description": "Complete the API reference guide",
"status": "pending",
"priority": "high",
"dueDate": null,
"archived": false,
"createdAt": "2026-04-01T12:00:00.000Z",
"updatedAt": "2026-04-01T12:00:00.000Z"
},
{
"id": "87bd2ab1-033b-5369-b8e7-687307ff4f1b",
"title": "Review pull request",
"description": null,
"status": "completed",
"priority": "medium",
"dueDate": null,
"archived": false,
"createdAt": "2026-04-01T12:00:00.000Z",
"updatedAt": "2026-04-01T12:00:00.000Z"
}
],
"pagination": {
"items": 2,
"total": 1,
"current": 1,
"next": null,
"prev": null
}
}Get task details
Request
http
GET /brave_eagle/tasks/0ec28309-26a2-5f19-92c0-3b60b8796f2eResponse 200
json
{
"task": {
"id": "0ec28309-26a2-5f19-92c0-3b60b8796f2e",
"title": "Implement login",
"description": "Add OAuth2 support",
"status": "in_progress",
"priority": "critical",
"dueDate": "2024-02-01T00:00:00.000Z",
"archived": false,
"createdAt": "2026-04-01T12:00:00.000Z",
"updatedAt": "2026-04-01T12:00:00.000Z"
}
}Create a task
Request
http
POST /brave_eagle/tasks
Content-Type: application/json
{
"task": {
"title": "New feature implementation",
"description": "Implement the new dashboard widget",
"status": "pending",
"priority": "high",
"dueDate": "2024-02-01"
}
}Response 201
json
{
"task": {
"id": "0ec28309-26a2-5f19-92c0-3b60b8796f2e",
"title": "New feature implementation",
"description": "Implement the new dashboard widget",
"status": "pending",
"priority": "high",
"dueDate": "2024-02-01T00:00:00.000Z",
"archived": false,
"createdAt": "2026-04-01T12:00:00.000Z",
"updatedAt": "2026-04-01T12:00:00.000Z"
}
}Archive a task (deprecated)
Request
http
PATCH /brave_eagle/tasks/0ec28309-26a2-5f19-92c0-3b60b8796f2e/archiveResponse 200
json
{
"task": {
"id": "0ec28309-26a2-5f19-92c0-3b60b8796f2e",
"title": "Old task to archive",
"description": null,
"status": "completed",
"priority": "medium",
"dueDate": null,
"archived": true,
"createdAt": "2026-04-01T12:00:00.000Z",
"updatedAt": "2026-04-01T12:00:00.000Z"
}
}Exports
OpenAPI
yml
---
openapi: 3.1.0
info:
contact:
email: support@example.com
name: API Support
description: API for managing tasks and projects
license:
name: MIT
url: https://opensource.org/licenses/MIT
title: Task Management API
version: 1.0.0
paths:
"/tasks":
get:
description: Returns a paginated list of tasks with optional filtering by status
and priority
operationId: listTasks
summary: List all tasks
tags:
- Tasks
- Core
parameters:
- in: query
name: filter
required: false
schema:
oneOf:
- "$ref": "#/components/schemas/taskFilter"
- items:
"$ref": "#/components/schemas/taskFilter"
type: array
- in: query
name: include
required: false
schema:
"$ref": "#/components/schemas/taskInclude"
- in: query
name: page
required: false
schema:
"$ref": "#/components/schemas/taskPage"
- in: query
name: sort
required: false
schema:
oneOf:
- "$ref": "#/components/schemas/taskSort"
- items:
"$ref": "#/components/schemas/taskSort"
type: array
responses:
'200':
content:
application/json:
schema:
properties:
meta:
properties: {}
type: object
pagination:
"$ref": "#/components/schemas/offsetPagination"
tasks:
items:
"$ref": "#/components/schemas/task"
type: array
type: object
required:
- pagination
- tasks
description: ''
post:
description: Creates a task and returns the created resource
operationId: createTask
summary: Create a new task
tags:
- Tasks
parameters:
- in: query
name: include
required: false
schema:
"$ref": "#/components/schemas/taskInclude"
requestBody:
content:
application/json:
schema:
properties:
task:
"$ref": "#/components/schemas/taskCreatePayload"
type: object
required:
- task
required: true
description: The task to create
responses:
'200':
content:
application/json:
schema:
properties:
meta:
properties: {}
type: object
task:
"$ref": "#/components/schemas/task"
type: object
required:
- task
description: ''
'422':
description: Unprocessable Entity
content:
application/json:
schema:
properties:
issues:
items:
"$ref": "#/components/schemas/error"
type: array
required:
- issues
type: object
"/tasks/{id}":
get:
description: Returns a single task by ID
operationId: getTask
summary: Get task details
tags:
- Tasks
parameters:
- in: path
name: id
required: true
schema:
type: string
- in: query
name: include
required: false
schema:
"$ref": "#/components/schemas/taskInclude"
responses:
'200':
content:
application/json:
schema:
properties:
meta:
properties: {}
type: object
task:
"$ref": "#/components/schemas/task"
type: object
required:
- task
description: The task
patch:
description: Updates an existing task
operationId: updateTask
summary: Update a task
tags:
- Tasks
parameters:
- in: path
name: id
required: true
schema:
type: string
- in: query
name: include
required: false
schema:
"$ref": "#/components/schemas/taskInclude"
requestBody:
content:
application/json:
schema:
properties:
task:
"$ref": "#/components/schemas/taskUpdatePayload"
type: object
required:
- task
required: true
responses:
'200':
content:
application/json:
schema:
properties:
meta:
properties: {}
type: object
task:
"$ref": "#/components/schemas/task"
type: object
required:
- task
description: ''
'422':
description: Unprocessable Entity
content:
application/json:
schema:
properties:
issues:
items:
"$ref": "#/components/schemas/error"
type: array
required:
- issues
type: object
delete:
description: Permanently removes a task
operationId: deleteTask
summary: Delete a task
tags:
- Tasks
parameters:
- in: path
name: id
required: true
schema:
type: string
- in: query
name: include
required: false
schema:
"$ref": "#/components/schemas/taskInclude"
responses:
'204':
description: ''
"/tasks/{id}/archive":
patch:
deprecated: true
description: Marks a task as archived. Archived tasks are hidden from default
listings but can still be retrieved.
operationId: archiveTask
summary: Archive a task
tags:
- Tasks
- Lifecycle
parameters:
- in: path
name: id
required: true
schema:
type: string
- in: query
name: include
required: false
schema:
"$ref": "#/components/schemas/taskInclude"
responses:
'200':
content:
application/json:
schema:
properties:
meta:
properties: {}
type: object
task:
"$ref": "#/components/schemas/task"
type: object
required:
- task
description: ''
'422':
description: Unprocessable Entity
content:
application/json:
schema:
properties:
issues:
items:
"$ref": "#/components/schemas/error"
type: array
required:
- issues
type: object
components:
schemas:
comment:
properties:
authorName:
type:
- string
- 'null'
description: Name of the person who wrote the comment
example: John Doe
body:
type: string
description: Comment content
example: This looks good, ready for review.
createdAt:
type: string
format: date-time
description: When the comment was created
id:
type: string
description: Unique comment identifier
updatedAt:
type: string
format: date-time
description: When the comment was last updated
type: object
description: A comment on a task
required:
- authorName
- body
- createdAt
- id
- updatedAt
error:
properties:
issues:
items:
"$ref": "#/components/schemas/errorIssue"
type: array
layer:
enum:
- http
- contract
- domain
type: string
type: object
required:
- issues
- layer
errorIssue:
properties:
code:
type: string
detail:
type: string
meta:
properties: {}
type: object
path:
items:
oneOf:
- type: string
- type: integer
type: array
pointer:
type: string
type: object
required:
- code
- detail
- meta
- path
- pointer
offsetPagination:
properties:
current:
type: integer
items:
type: integer
next:
type:
- integer
- 'null'
prev:
type:
- integer
- 'null'
total:
type: integer
type: object
required:
- current
- items
- total
task:
properties:
archived:
type:
- boolean
- 'null'
description: Whether the task has been archived
deprecated: true
assignee:
oneOf:
- "$ref": "#/components/schemas/user"
- type: 'null'
comments:
items:
"$ref": "#/components/schemas/comment"
type: array
description: Discussion comments on this task
createdAt:
type: string
format: date-time
description: Timestamp when the task was created
description:
type:
- string
- 'null'
description: Detailed description of what needs to be done
example: Add OAuth2 login support for Google and GitHub providers
dueDate:
type:
- string
- 'null'
format: date-time
description: Target date for task completion
example: '2024-02-01T00:00:00Z'
id:
type: string
description: Unique task identifier
priority:
enum:
- low
- medium
- high
- critical
type:
- string
- 'null'
status:
enum:
- pending
- in_progress
- completed
- archived
type:
- string
- 'null'
title:
type: string
description: Short title describing the task
example: Implement user authentication
updatedAt:
type: string
format: date-time
description: Timestamp of last modification
type: object
description: A task representing work to be completed
required:
- archived
- createdAt
- description
- dueDate
- id
- priority
- status
- title
- updatedAt
taskCreatePayload:
properties:
description:
type:
- string
- 'null'
description: Detailed description of what needs to be done
example: Add OAuth2 login support for Google and GitHub providers
default:
dueDate:
type:
- string
- 'null'
format: date-time
description: Target date for task completion
example: '2024-02-01T00:00:00Z'
default:
priority:
enum:
- low
- medium
- high
- critical
type:
- string
- 'null'
status:
enum:
- pending
- in_progress
- completed
- archived
type:
- string
- 'null'
title:
type: string
description: Short title describing the task
example: Implement user authentication
type: object
description: A task representing work to be completed
required:
- title
taskFilter:
properties:
AND:
items:
"$ref": "#/components/schemas/taskFilter"
type: array
NOT:
"$ref": "#/components/schemas/taskFilter"
OR:
items:
"$ref": "#/components/schemas/taskFilter"
type: array
priority:
"$ref": "#/components/schemas/taskPriorityFilter"
status:
"$ref": "#/components/schemas/taskStatusFilter"
type: object
taskInclude:
properties:
assignee:
type: boolean
comments:
type: boolean
type: object
taskPage:
properties:
number:
type: integer
minimum: 1
size:
type: integer
minimum: 1
maximum: 100
type: object
taskPriorityFilter:
oneOf:
- enum:
- low
- medium
- high
- critical
type: string
- properties:
eq:
enum:
- low
- medium
- high
- critical
type: string
in:
items:
enum:
- low
- medium
- high
- critical
type: string
type: array
type: object
required:
- eq
- in
taskSort:
properties:
createdAt:
enum:
- asc
- desc
type: string
dueDate:
enum:
- asc
- desc
type: string
updatedAt:
enum:
- asc
- desc
type: string
type: object
taskStatusFilter:
oneOf:
- enum:
- pending
- in_progress
- completed
- archived
type: string
- properties:
eq:
enum:
- pending
- in_progress
- completed
- archived
type: string
in:
items:
enum:
- pending
- in_progress
- completed
- archived
type: string
type: array
type: object
required:
- eq
- in
taskUpdatePayload:
properties:
description:
type:
- string
- 'null'
description: Detailed description of what needs to be done
example: Add OAuth2 login support for Google and GitHub providers
dueDate:
type:
- string
- 'null'
format: date-time
description: Target date for task completion
example: '2024-02-01T00:00:00Z'
priority:
enum:
- low
- medium
- high
- critical
type:
- string
- 'null'
status:
enum:
- pending
- in_progress
- completed
- archived
type:
- string
- 'null'
title:
type: string
description: Short title describing the task
example: Implement user authentication
type: object
description: A task representing work to be completed
user:
properties:
email:
type: string
description: User's email address
example: jane@example.com
format: email
id:
type: string
description: Unique user identifier
name:
type: string
description: User's display name
example: Jane Doe
type: object
description: A user who can be assigned to tasks
required:
- email
- id
- nameApiwork
json
{
"base_path": "/brave_eagle",
"enums": [
{
"deprecated": false,
"description": null,
"example": null,
"name": "error_layer",
"scope": null,
"values": [
"http",
"contract",
"domain"
]
},
{
"deprecated": false,
"description": null,
"example": null,
"name": "sort_direction",
"scope": null,
"values": [
"asc",
"desc"
]
},
{
"deprecated": false,
"description": null,
"example": null,
"name": "task_priority",
"scope": "task",
"values": [
"low",
"medium",
"high",
"critical"
]
},
{
"deprecated": false,
"description": null,
"example": null,
"name": "task_status",
"scope": "task",
"values": [
"pending",
"in_progress",
"completed",
"archived"
]
}
],
"error_codes": [
{
"description": "Unprocessable Entity",
"name": "unprocessable_entity",
"status": 422
}
],
"fingerprint": "1ab002d1fe7bcf31",
"info": {
"contact": {
"email": "support@example.com",
"name": "API Support",
"url": null
},
"description": "API for managing tasks and projects",
"license": {
"name": "MIT",
"url": "https://opensource.org/licenses/MIT"
},
"servers": [],
"summary": null,
"terms_of_service": null,
"title": "Task Management API",
"version": "1.0.0"
},
"locales": [],
"resources": [
{
"actions": [
{
"name": "tasks.index",
"deprecated": false,
"description": "Returns a paginated list of tasks with optional filtering by status and priority",
"method": "get",
"operation_id": "listTasks",
"path": "/tasks",
"raises": [],
"request": {
"body": [],
"description": null,
"query": [
{
"name": "filter",
"deprecated": false,
"description": null,
"nullable": false,
"optional": true,
"type": "union",
"discriminator": "",
"variants": [
{
"deprecated": false,
"description": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "task_filter"
},
{
"deprecated": false,
"description": null,
"nullable": false,
"optional": false,
"type": "array",
"example": null,
"max": null,
"min": null,
"of": {
"deprecated": false,
"description": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "task_filter"
}
}
]
},
{
"name": "include",
"deprecated": false,
"description": null,
"nullable": false,
"optional": true,
"type": "reference",
"reference": "task_include"
},
{
"name": "page",
"deprecated": false,
"description": null,
"nullable": false,
"optional": true,
"type": "reference",
"reference": "task_page"
},
{
"name": "sort",
"deprecated": false,
"description": null,
"nullable": false,
"optional": true,
"type": "union",
"discriminator": "",
"variants": [
{
"deprecated": false,
"description": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "task_sort"
},
{
"deprecated": false,
"description": null,
"nullable": false,
"optional": false,
"type": "array",
"example": null,
"max": null,
"min": null,
"of": {
"deprecated": false,
"description": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "task_sort"
}
}
]
}
]
},
"response": {
"body": {
"deprecated": null,
"description": null,
"nullable": null,
"optional": null,
"type": "object",
"partial": null,
"shape": [
{
"name": "meta",
"deprecated": false,
"description": null,
"nullable": false,
"optional": true,
"type": "object",
"partial": false,
"shape": []
},
{
"name": "pagination",
"deprecated": false,
"description": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "offset_pagination"
},
{
"name": "tasks",
"deprecated": false,
"description": null,
"nullable": false,
"optional": false,
"type": "array",
"example": null,
"max": null,
"min": null,
"of": {
"deprecated": false,
"description": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "task"
}
}
]
},
"description": null,
"no_content": false
},
"summary": "List all tasks",
"tags": [
"Tasks",
"Core"
]
},
{
"name": "tasks.show",
"deprecated": false,
"description": "Returns a single task by ID",
"method": "get",
"operation_id": "getTask",
"path": "/tasks/:id",
"raises": [],
"request": {
"body": [],
"description": null,
"query": [
{
"name": "include",
"deprecated": false,
"description": null,
"nullable": false,
"optional": true,
"type": "reference",
"reference": "task_include"
}
]
},
"response": {
"body": {
"deprecated": null,
"description": null,
"nullable": null,
"optional": null,
"type": "object",
"partial": null,
"shape": [
{
"name": "meta",
"deprecated": false,
"description": null,
"nullable": false,
"optional": true,
"type": "object",
"partial": false,
"shape": []
},
{
"name": "task",
"deprecated": false,
"description": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "task"
}
]
},
"description": "The task",
"no_content": false
},
"summary": "Get task details",
"tags": [
"Tasks"
]
},
{
"name": "tasks.create",
"deprecated": false,
"description": "Creates a task and returns the created resource",
"method": "post",
"operation_id": "createTask",
"path": "/tasks",
"raises": [
"unprocessable_entity"
],
"request": {
"body": [
{
"name": "task",
"deprecated": false,
"description": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "task_create_payload"
}
],
"description": "The task to create",
"query": [
{
"name": "include",
"deprecated": false,
"description": null,
"nullable": false,
"optional": true,
"type": "reference",
"reference": "task_include"
}
]
},
"response": {
"body": {
"deprecated": null,
"description": null,
"nullable": null,
"optional": null,
"type": "object",
"partial": null,
"shape": [
{
"name": "meta",
"deprecated": false,
"description": null,
"nullable": false,
"optional": true,
"type": "object",
"partial": false,
"shape": []
},
{
"name": "task",
"deprecated": false,
"description": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "task"
}
]
},
"description": null,
"no_content": false
},
"summary": "Create a new task",
"tags": [
"Tasks"
]
},
{
"name": "tasks.update",
"deprecated": false,
"description": "Updates an existing task",
"method": "patch",
"operation_id": "updateTask",
"path": "/tasks/:id",
"raises": [
"unprocessable_entity"
],
"request": {
"body": [
{
"name": "task",
"deprecated": false,
"description": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "task_update_payload"
}
],
"description": null,
"query": [
{
"name": "include",
"deprecated": false,
"description": null,
"nullable": false,
"optional": true,
"type": "reference",
"reference": "task_include"
}
]
},
"response": {
"body": {
"deprecated": null,
"description": null,
"nullable": null,
"optional": null,
"type": "object",
"partial": null,
"shape": [
{
"name": "meta",
"deprecated": false,
"description": null,
"nullable": false,
"optional": true,
"type": "object",
"partial": false,
"shape": []
},
{
"name": "task",
"deprecated": false,
"description": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "task"
}
]
},
"description": null,
"no_content": false
},
"summary": "Update a task",
"tags": [
"Tasks"
]
},
{
"name": "tasks.destroy",
"deprecated": false,
"description": "Permanently removes a task",
"method": "delete",
"operation_id": "deleteTask",
"path": "/tasks/:id",
"raises": [],
"request": {
"body": [],
"description": null,
"query": [
{
"name": "include",
"deprecated": false,
"description": null,
"nullable": false,
"optional": true,
"type": "reference",
"reference": "task_include"
}
]
},
"response": {
"body": null,
"description": null,
"no_content": true
},
"summary": "Delete a task",
"tags": [
"Tasks"
]
},
{
"name": "tasks.archive",
"deprecated": true,
"description": "Marks a task as archived. Archived tasks are hidden from default listings but can still be retrieved.",
"method": "patch",
"operation_id": "archiveTask",
"path": "/tasks/:id/archive",
"raises": [
"unprocessable_entity"
],
"request": {
"body": [],
"description": null,
"query": [
{
"name": "include",
"deprecated": false,
"description": null,
"nullable": false,
"optional": true,
"type": "reference",
"reference": "task_include"
}
]
},
"response": {
"body": {
"deprecated": null,
"description": null,
"nullable": null,
"optional": null,
"type": "object",
"partial": null,
"shape": [
{
"name": "meta",
"deprecated": false,
"description": null,
"nullable": false,
"optional": true,
"type": "object",
"partial": false,
"shape": []
},
{
"name": "task",
"deprecated": false,
"description": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "task"
}
]
},
"description": null,
"no_content": false
},
"summary": "Archive a task",
"tags": [
"Tasks",
"Lifecycle"
]
}
],
"identifier": "tasks",
"name": "tasks",
"parent_identifiers": [],
"path": "tasks",
"resources": [],
"scope": "task"
}
],
"types": [
{
"recursive": true,
"deprecated": false,
"description": null,
"example": null,
"name": "task_filter",
"scope": "task",
"type": "object",
"extends": [],
"shape": [
{
"name": "AND",
"deprecated": false,
"description": null,
"nullable": false,
"optional": true,
"type": "array",
"example": null,
"max": null,
"min": null,
"of": {
"deprecated": false,
"description": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "task_filter"
}
},
{
"name": "NOT",
"deprecated": false,
"description": null,
"nullable": false,
"optional": true,
"type": "reference",
"reference": "task_filter"
},
{
"name": "OR",
"deprecated": false,
"description": null,
"nullable": false,
"optional": true,
"type": "array",
"example": null,
"max": null,
"min": null,
"of": {
"deprecated": false,
"description": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "task_filter"
}
},
{
"name": "priority",
"deprecated": false,
"description": null,
"nullable": false,
"optional": true,
"type": "reference",
"reference": "task_priority_filter"
},
{
"name": "status",
"deprecated": false,
"description": null,
"nullable": false,
"optional": true,
"type": "reference",
"reference": "task_status_filter"
}
]
},
{
"recursive": false,
"deprecated": false,
"description": "A comment on a task",
"example": null,
"name": "comment",
"scope": "comment",
"type": "object",
"extends": [],
"shape": [
{
"name": "authorName",
"deprecated": false,
"description": "Name of the person who wrote the comment",
"nullable": true,
"optional": false,
"type": "string",
"example": "John Doe",
"format": null,
"max": null,
"min": null
},
{
"name": "body",
"deprecated": false,
"description": "Comment content",
"nullable": false,
"optional": false,
"type": "string",
"example": "This looks good, ready for review.",
"format": null,
"max": null,
"min": null
},
{
"name": "createdAt",
"deprecated": false,
"description": "When the comment was created",
"nullable": false,
"optional": false,
"type": "datetime",
"example": null
},
{
"name": "id",
"deprecated": false,
"description": "Unique comment identifier",
"nullable": false,
"optional": false,
"type": "string",
"example": null,
"format": null,
"max": null,
"min": null
},
{
"name": "updatedAt",
"deprecated": false,
"description": "When the comment was last updated",
"nullable": false,
"optional": false,
"type": "datetime",
"example": null
}
]
},
{
"recursive": false,
"deprecated": false,
"description": null,
"example": null,
"name": "error_issue",
"scope": null,
"type": "object",
"extends": [],
"shape": [
{
"name": "code",
"deprecated": false,
"description": null,
"nullable": false,
"optional": false,
"type": "string",
"example": null,
"format": null,
"max": null,
"min": null
},
{
"name": "detail",
"deprecated": false,
"description": null,
"nullable": false,
"optional": false,
"type": "string",
"example": null,
"format": null,
"max": null,
"min": null
},
{
"name": "meta",
"deprecated": false,
"description": null,
"nullable": false,
"optional": false,
"type": "object",
"partial": false,
"shape": []
},
{
"name": "path",
"deprecated": false,
"description": null,
"nullable": false,
"optional": false,
"type": "array",
"example": null,
"max": null,
"min": null,
"of": {
"deprecated": false,
"description": null,
"nullable": false,
"optional": false,
"type": "union",
"discriminator": "",
"variants": [
{
"deprecated": false,
"description": null,
"nullable": false,
"optional": false,
"type": "string",
"example": null,
"format": null,
"max": null,
"min": null
},
{
"deprecated": false,
"description": null,
"nullable": false,
"optional": false,
"type": "integer",
"example": null,
"format": null,
"max": null,
"min": null
}
]
}
},
{
"name": "pointer",
"deprecated": false,
"description": null,
"nullable": false,
"optional": false,
"type": "string",
"example": null,
"format": null,
"max": null,
"min": null
}
]
},
{
"recursive": false,
"deprecated": false,
"description": null,
"example": null,
"name": "offset_pagination",
"scope": null,
"type": "object",
"extends": [],
"shape": [
{
"name": "current",
"deprecated": false,
"description": null,
"nullable": false,
"optional": false,
"type": "integer",
"example": null,
"format": null,
"max": null,
"min": null
},
{
"name": "items",
"deprecated": false,
"description": null,
"nullable": false,
"optional": false,
"type": "integer",
"example": null,
"format": null,
"max": null,
"min": null
},
{
"name": "next",
"deprecated": false,
"description": null,
"nullable": true,
"optional": true,
"type": "integer",
"example": null,
"format": null,
"max": null,
"min": null
},
{
"name": "prev",
"deprecated": false,
"description": null,
"nullable": true,
"optional": true,
"type": "integer",
"example": null,
"format": null,
"max": null,
"min": null
},
{
"name": "total",
"deprecated": false,
"description": null,
"nullable": false,
"optional": false,
"type": "integer",
"example": null,
"format": null,
"max": null,
"min": null
}
]
},
{
"recursive": false,
"deprecated": false,
"description": "A task representing work to be completed",
"example": null,
"name": "task_create_payload",
"scope": "task",
"type": "object",
"extends": [],
"shape": [
{
"name": "description",
"deprecated": false,
"description": "Detailed description of what needs to be done",
"nullable": true,
"optional": true,
"type": "string",
"default": null,
"example": "Add OAuth2 login support for Google and GitHub providers",
"format": null,
"max": null,
"min": null
},
{
"name": "dueDate",
"deprecated": false,
"description": "Target date for task completion",
"nullable": true,
"optional": true,
"type": "datetime",
"default": null,
"example": "2024-02-01T00:00:00Z"
},
{
"name": "priority",
"deprecated": false,
"description": "Priority level for task ordering",
"nullable": true,
"optional": true,
"type": "string",
"default": "medium",
"enum": "task_priority",
"example": "high",
"format": null,
"max": null,
"min": null
},
{
"name": "status",
"deprecated": false,
"description": "Current status of the task",
"nullable": true,
"optional": true,
"type": "string",
"default": "pending",
"enum": "task_status",
"example": "pending",
"format": null,
"max": null,
"min": null
},
{
"name": "title",
"deprecated": false,
"description": "Short title describing the task",
"nullable": false,
"optional": false,
"type": "string",
"example": "Implement user authentication",
"format": null,
"max": null,
"min": null
}
]
},
{
"recursive": false,
"deprecated": false,
"description": null,
"example": null,
"name": "task_include",
"scope": "task",
"type": "object",
"extends": [],
"shape": [
{
"name": "assignee",
"deprecated": false,
"description": null,
"nullable": false,
"optional": true,
"type": "boolean",
"example": null
},
{
"name": "comments",
"deprecated": false,
"description": null,
"nullable": false,
"optional": true,
"type": "boolean",
"example": null
}
]
},
{
"recursive": false,
"deprecated": false,
"description": null,
"example": null,
"name": "task_page",
"scope": "task",
"type": "object",
"extends": [],
"shape": [
{
"name": "number",
"deprecated": false,
"description": null,
"nullable": false,
"optional": true,
"type": "integer",
"example": null,
"format": null,
"max": null,
"min": 1
},
{
"name": "size",
"deprecated": false,
"description": null,
"nullable": false,
"optional": true,
"type": "integer",
"example": null,
"format": null,
"max": 100,
"min": 1
}
]
},
{
"recursive": false,
"deprecated": false,
"description": null,
"example": null,
"name": "task_priority_filter",
"scope": "task",
"type": "union",
"discriminator": "",
"variants": [
{
"deprecated": false,
"description": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "task_priority"
},
{
"deprecated": false,
"description": null,
"nullable": false,
"optional": false,
"type": "object",
"partial": true,
"shape": [
{
"name": "eq",
"deprecated": false,
"description": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "task_priority"
},
{
"name": "in",
"deprecated": false,
"description": null,
"nullable": false,
"optional": false,
"type": "array",
"example": null,
"max": null,
"min": null,
"of": {
"deprecated": false,
"description": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "task_priority"
}
}
]
}
]
},
{
"recursive": false,
"deprecated": false,
"description": null,
"example": null,
"name": "task_sort",
"scope": "task",
"type": "object",
"extends": [],
"shape": [
{
"name": "createdAt",
"deprecated": false,
"description": null,
"nullable": false,
"optional": true,
"type": "reference",
"reference": "sort_direction"
},
{
"name": "dueDate",
"deprecated": false,
"description": null,
"nullable": false,
"optional": true,
"type": "reference",
"reference": "sort_direction"
},
{
"name": "updatedAt",
"deprecated": false,
"description": null,
"nullable": false,
"optional": true,
"type": "reference",
"reference": "sort_direction"
}
]
},
{
"recursive": false,
"deprecated": false,
"description": null,
"example": null,
"name": "task_status_filter",
"scope": "task",
"type": "union",
"discriminator": "",
"variants": [
{
"deprecated": false,
"description": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "task_status"
},
{
"deprecated": false,
"description": null,
"nullable": false,
"optional": false,
"type": "object",
"partial": true,
"shape": [
{
"name": "eq",
"deprecated": false,
"description": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "task_status"
},
{
"name": "in",
"deprecated": false,
"description": null,
"nullable": false,
"optional": false,
"type": "array",
"example": null,
"max": null,
"min": null,
"of": {
"deprecated": false,
"description": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "task_status"
}
}
]
}
]
},
{
"recursive": false,
"deprecated": false,
"description": "A task representing work to be completed",
"example": null,
"name": "task_update_payload",
"scope": "task",
"type": "object",
"extends": [],
"shape": [
{
"name": "description",
"deprecated": false,
"description": "Detailed description of what needs to be done",
"nullable": true,
"optional": true,
"type": "string",
"example": "Add OAuth2 login support for Google and GitHub providers",
"format": null,
"max": null,
"min": null
},
{
"name": "dueDate",
"deprecated": false,
"description": "Target date for task completion",
"nullable": true,
"optional": true,
"type": "datetime",
"example": "2024-02-01T00:00:00Z"
},
{
"name": "priority",
"deprecated": false,
"description": "Priority level for task ordering",
"nullable": true,
"optional": true,
"type": "string",
"enum": "task_priority",
"example": "high",
"format": null,
"max": null,
"min": null
},
{
"name": "status",
"deprecated": false,
"description": "Current status of the task",
"nullable": true,
"optional": true,
"type": "string",
"enum": "task_status",
"example": "pending",
"format": null,
"max": null,
"min": null
},
{
"name": "title",
"deprecated": false,
"description": "Short title describing the task",
"nullable": false,
"optional": true,
"type": "string",
"example": "Implement user authentication",
"format": null,
"max": null,
"min": null
}
]
},
{
"recursive": false,
"deprecated": false,
"description": "A user who can be assigned to tasks",
"example": null,
"name": "user",
"scope": "user",
"type": "object",
"extends": [],
"shape": [
{
"name": "email",
"deprecated": false,
"description": "User's email address",
"nullable": false,
"optional": false,
"type": "string",
"example": "jane@example.com",
"format": "email",
"max": null,
"min": null
},
{
"name": "id",
"deprecated": false,
"description": "Unique user identifier",
"nullable": false,
"optional": false,
"type": "string",
"example": null,
"format": null,
"max": null,
"min": null
},
{
"name": "name",
"deprecated": false,
"description": "User's display name",
"nullable": false,
"optional": false,
"type": "string",
"example": "Jane Doe",
"format": null,
"max": null,
"min": null
}
]
},
{
"recursive": false,
"deprecated": false,
"description": null,
"example": null,
"name": "error",
"scope": null,
"type": "object",
"extends": [],
"shape": [
{
"name": "issues",
"deprecated": false,
"description": null,
"nullable": false,
"optional": false,
"type": "array",
"example": null,
"max": null,
"min": null,
"of": {
"deprecated": false,
"description": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "error_issue"
}
},
{
"name": "layer",
"deprecated": false,
"description": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "error_layer"
}
]
},
{
"recursive": false,
"deprecated": false,
"description": "A task representing work to be completed",
"example": null,
"name": "task",
"scope": "task",
"type": "object",
"extends": [],
"shape": [
{
"name": "archived",
"deprecated": true,
"description": "Whether the task has been archived",
"nullable": true,
"optional": false,
"type": "boolean",
"example": null
},
{
"name": "assignee",
"deprecated": false,
"description": "User responsible for completing this task",
"nullable": true,
"optional": true,
"type": "reference",
"reference": "user"
},
{
"name": "comments",
"deprecated": false,
"description": "Discussion comments on this task",
"nullable": false,
"optional": true,
"type": "array",
"example": null,
"max": null,
"min": null,
"of": {
"deprecated": false,
"description": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "comment"
}
},
{
"name": "createdAt",
"deprecated": false,
"description": "Timestamp when the task was created",
"nullable": false,
"optional": false,
"type": "datetime",
"example": null
},
{
"name": "description",
"deprecated": false,
"description": "Detailed description of what needs to be done",
"nullable": true,
"optional": false,
"type": "string",
"example": "Add OAuth2 login support for Google and GitHub providers",
"format": null,
"max": null,
"min": null
},
{
"name": "dueDate",
"deprecated": false,
"description": "Target date for task completion",
"nullable": true,
"optional": false,
"type": "datetime",
"example": "2024-02-01T00:00:00Z"
},
{
"name": "id",
"deprecated": false,
"description": "Unique task identifier",
"nullable": false,
"optional": false,
"type": "string",
"example": null,
"format": null,
"max": null,
"min": null
},
{
"name": "priority",
"deprecated": false,
"description": "Priority level for task ordering",
"nullable": true,
"optional": false,
"type": "string",
"enum": "task_priority",
"example": "high",
"format": null,
"max": null,
"min": null
},
{
"name": "status",
"deprecated": false,
"description": "Current status of the task",
"nullable": true,
"optional": false,
"type": "string",
"enum": "task_status",
"example": "pending",
"format": null,
"max": null,
"min": null
},
{
"name": "title",
"deprecated": false,
"description": "Short title describing the task",
"nullable": false,
"optional": false,
"type": "string",
"example": "Implement user authentication",
"format": null,
"max": null,
"min": null
},
{
"name": "updatedAt",
"deprecated": false,
"description": "Timestamp of last modification",
"nullable": false,
"optional": false,
"type": "datetime",
"example": null
}
]
}
]
}Codegen
TypeScript
ts
export type ErrorLayer = 'http' | 'contract' | 'domain';
export type SortDirection = 'asc' | 'desc';
export interface ErrorIssue {
code: string;
detail: string;
meta: Record<string, unknown>;
path: string | number[];
pointer: string;
}
export interface OffsetPagination {
current: number;
items: number;
next?: number | null;
prev?: number | null;
total: number;
}
export interface Error {
issues: ErrorIssue[];
layer: ErrorLayer;
}ts
export interface Comment {
authorName: string | null;
body: string;
createdAt: string;
id: string;
updatedAt: string;
}ts
export * from './comment';
export * from './task';
export * from './user';ts
import type { SortDirection } from '../api';
import type { Comment } from './comment';
import type { User } from './user';
export type TaskPriority = 'low' | 'medium' | 'high' | 'critical';
export type TaskStatus = 'pending' | 'in_progress' | 'completed' | 'archived';
export interface TaskFilter {
AND?: TaskFilter[];
NOT?: TaskFilter;
OR?: TaskFilter[];
priority?: TaskPriorityFilter;
status?: TaskStatusFilter;
}
export interface TaskCreatePayload {
description?: string | null;
dueDate?: string | null;
priority?: TaskPriority | null;
status?: TaskStatus | null;
title: string;
}
export interface TaskInclude {
assignee?: boolean;
comments?: boolean;
}
export interface TaskPage {
number?: number;
size?: number;
}
export type TaskPriorityFilter =
| TaskPriority
| { eq?: TaskPriority; in?: TaskPriority[] };
export interface TaskSort {
createdAt?: SortDirection;
dueDate?: SortDirection;
updatedAt?: SortDirection;
}
export type TaskStatusFilter =
| TaskStatus
| { eq?: TaskStatus; in?: TaskStatus[] };
export interface TaskUpdatePayload {
description?: string | null;
dueDate?: string | null;
priority?: TaskPriority | null;
status?: TaskStatus | null;
title?: string;
}
export interface Task {
archived: boolean | null;
assignee?: User | null;
comments?: Comment[];
createdAt: string;
description: string | null;
dueDate: string | null;
id: string;
priority: TaskPriority | null;
status: TaskStatus | null;
title: string;
updatedAt: string;
}ts
export interface User {
email: string;
id: string;
name: string;
}ts
export * from './tasks';ts
import type { OffsetPagination } from '../api';
import type {
Task,
TaskCreatePayload,
TaskFilter,
TaskInclude,
TaskPage,
TaskSort,
TaskUpdatePayload,
} from '../domains/task';
export type TasksIndexMethod = 'GET';
export type TasksIndexPath = '/tasks';
export interface TasksIndexRequestQuery {
filter?: TaskFilter | TaskFilter[];
include?: TaskInclude;
page?: TaskPage;
sort?: TaskSort | TaskSort[];
}
export type TasksIndexResponseBody = {
meta?: Record<string, unknown>;
pagination: OffsetPagination;
tasks: Task[];
};
export interface TasksIndexRequest {
query: TasksIndexRequestQuery;
}
export interface TasksIndexResponse {
body: TasksIndexResponseBody;
}
export interface TasksIndex {
method: TasksIndexMethod;
path: TasksIndexPath;
request: TasksIndexRequest;
response: TasksIndexResponse;
}
export type TasksShowMethod = 'GET';
export type TasksShowPath = '/tasks/:id';
export interface TasksShowPathParams {
id: string;
}
export interface TasksShowRequestQuery {
include?: TaskInclude;
}
export type TasksShowResponseBody = {
meta?: Record<string, unknown>;
task: Task;
};
export interface TasksShowRequest {
query: TasksShowRequestQuery;
}
export interface TasksShowResponse {
body: TasksShowResponseBody;
}
export interface TasksShow {
method: TasksShowMethod;
path: TasksShowPath;
pathParams: TasksShowPathParams;
request: TasksShowRequest;
response: TasksShowResponse;
}
export type TasksCreateMethod = 'POST';
export type TasksCreatePath = '/tasks';
export interface TasksCreateRequestQuery {
include?: TaskInclude;
}
export interface TasksCreateRequestBody {
task: TaskCreatePayload;
}
export type TasksCreateResponseBody = {
meta?: Record<string, unknown>;
task: Task;
};
export interface TasksCreateRequest {
body: TasksCreateRequestBody;
query: TasksCreateRequestQuery;
}
export interface TasksCreateResponse {
body: TasksCreateResponseBody;
}
export type TasksCreateErrors = 422;
export interface TasksCreate {
errors: TasksCreateErrors;
method: TasksCreateMethod;
path: TasksCreatePath;
request: TasksCreateRequest;
response: TasksCreateResponse;
}
export type TasksUpdateMethod = 'PATCH';
export type TasksUpdatePath = '/tasks/:id';
export interface TasksUpdatePathParams {
id: string;
}
export interface TasksUpdateRequestQuery {
include?: TaskInclude;
}
export interface TasksUpdateRequestBody {
task: TaskUpdatePayload;
}
export type TasksUpdateResponseBody = {
meta?: Record<string, unknown>;
task: Task;
};
export interface TasksUpdateRequest {
body: TasksUpdateRequestBody;
query: TasksUpdateRequestQuery;
}
export interface TasksUpdateResponse {
body: TasksUpdateResponseBody;
}
export type TasksUpdateErrors = 422;
export interface TasksUpdate {
errors: TasksUpdateErrors;
method: TasksUpdateMethod;
path: TasksUpdatePath;
pathParams: TasksUpdatePathParams;
request: TasksUpdateRequest;
response: TasksUpdateResponse;
}
export type TasksDestroyMethod = 'DELETE';
export type TasksDestroyPath = '/tasks/:id';
export interface TasksDestroyPathParams {
id: string;
}
export interface TasksDestroyRequestQuery {
include?: TaskInclude;
}
export interface TasksDestroyRequest {
query: TasksDestroyRequestQuery;
}
export interface TasksDestroy {
method: TasksDestroyMethod;
path: TasksDestroyPath;
pathParams: TasksDestroyPathParams;
request: TasksDestroyRequest;
}
export type TasksArchiveMethod = 'PATCH';
export type TasksArchivePath = '/tasks/:id/archive';
export interface TasksArchivePathParams {
id: string;
}
export interface TasksArchiveRequestQuery {
include?: TaskInclude;
}
export type TasksArchiveResponseBody = {
meta?: Record<string, unknown>;
task: Task;
};
export interface TasksArchiveRequest {
query: TasksArchiveRequestQuery;
}
export interface TasksArchiveResponse {
body: TasksArchiveResponseBody;
}
export type TasksArchiveErrors = 422;
export interface TasksArchive {
errors: TasksArchiveErrors;
method: TasksArchiveMethod;
path: TasksArchivePath;
pathParams: TasksArchivePathParams;
request: TasksArchiveRequest;
response: TasksArchiveResponse;
}Zod
ts
import * as z from 'zod';
export const ErrorLayerSchema = z.enum(['contract', 'domain', 'http']);
export const SortDirectionSchema = z.enum(['asc', 'desc']);
export const ErrorIssueSchema = z.object({
code: z.string(),
detail: z.string(),
meta: z.record(z.string(), z.unknown()),
path: z.array(z.union([z.string(), z.number().int()])),
pointer: z.string(),
});
export const OffsetPaginationSchema = z.object({
current: z.number().int(),
items: z.number().int(),
next: z.number().int().nullable().optional(),
prev: z.number().int().nullable().optional(),
total: z.number().int(),
});
export const ErrorSchema = z.object({
issues: z.array(ErrorIssueSchema),
layer: ErrorLayerSchema,
});
export type ErrorLayer = 'contract' | 'domain' | 'http';
export type SortDirection = 'asc' | 'desc';
export interface ErrorIssue {
code: string;
detail: string;
meta: Record<string, unknown>;
path: string | number[];
pointer: string;
}
export interface OffsetPagination {
current: number;
items: number;
next?: number | null;
prev?: number | null;
total: number;
}
export interface Error {
issues: ErrorIssue[];
layer: ErrorLayer;
}ts
import * as z from 'zod';
export const CommentSchema = z.object({
authorName: z.string().nullable(),
body: z.string(),
createdAt: z.iso.datetime(),
id: z.string(),
updatedAt: z.iso.datetime(),
});
export interface Comment {
authorName: string | null;
body: string;
createdAt: string;
id: string;
updatedAt: string;
}ts
export * from './comment';
export * from './task';
export * from './user';ts
import type { SortDirection } from '../api';
import type { Comment } from './comment';
import type { User } from './user';
import * as z from 'zod';
import { SortDirectionSchema } from '../api';
import { CommentSchema } from './comment';
import { UserSchema } from './user';
export const TaskPrioritySchema = z.enum(['critical', 'high', 'low', 'medium']);
export const TaskStatusSchema = z.enum([
'archived',
'completed',
'in_progress',
'pending',
]);
export const TaskFilterSchema: z.ZodType<TaskFilter> = z.lazy(() =>
z.object({
AND: z.array(TaskFilterSchema).optional(),
NOT: TaskFilterSchema.optional(),
OR: z.array(TaskFilterSchema).optional(),
priority: TaskPriorityFilterSchema.optional(),
status: TaskStatusFilterSchema.optional(),
}),
);
export const TaskCreatePayloadSchema = z.object({
description: z.string().nullable().default(null),
dueDate: z.iso.datetime().nullable().default(null),
priority: TaskPrioritySchema.nullable().default('medium'),
status: TaskStatusSchema.nullable().default('pending'),
title: z.string(),
});
export const TaskIncludeSchema = z.object({
assignee: z.boolean().optional(),
comments: z.boolean().optional(),
});
export const TaskPageSchema = z.object({
number: z.number().int().min(1).optional(),
size: z.number().int().min(1).max(100).optional(),
});
export const TaskPriorityFilterSchema = z.union([
TaskPrioritySchema,
z
.object({ eq: TaskPrioritySchema, in: z.array(TaskPrioritySchema) })
.partial(),
]);
export const TaskSortSchema = z.object({
createdAt: SortDirectionSchema.optional(),
dueDate: SortDirectionSchema.optional(),
updatedAt: SortDirectionSchema.optional(),
});
export const TaskStatusFilterSchema = z.union([
TaskStatusSchema,
z.object({ eq: TaskStatusSchema, in: z.array(TaskStatusSchema) }).partial(),
]);
export const TaskUpdatePayloadSchema = z.object({
description: z.string().nullable().optional(),
dueDate: z.iso.datetime().nullable().optional(),
priority: TaskPrioritySchema.nullable().optional(),
status: TaskStatusSchema.nullable().optional(),
title: z.string().optional(),
});
export const TaskSchema = z.object({
archived: z.boolean().nullable(),
assignee: UserSchema.nullable().optional(),
comments: z.array(CommentSchema).optional(),
createdAt: z.iso.datetime(),
description: z.string().nullable(),
dueDate: z.iso.datetime().nullable(),
id: z.string(),
priority: TaskPrioritySchema.nullable(),
status: TaskStatusSchema.nullable(),
title: z.string(),
updatedAt: z.iso.datetime(),
});
export type TaskPriority = 'critical' | 'high' | 'low' | 'medium';
export type TaskStatus = 'archived' | 'completed' | 'in_progress' | 'pending';
export interface TaskFilter {
AND?: TaskFilter[];
NOT?: TaskFilter;
OR?: TaskFilter[];
priority?: TaskPriorityFilter;
status?: TaskStatusFilter;
}
export interface TaskCreatePayload {
description?: string | null;
dueDate?: string | null;
priority?: TaskPriority | null;
status?: TaskStatus | null;
title: string;
}
export interface TaskInclude {
assignee?: boolean;
comments?: boolean;
}
export interface TaskPage {
number?: number;
size?: number;
}
export type TaskPriorityFilter =
| TaskPriority
| { eq?: TaskPriority; in?: TaskPriority[] };
export interface TaskSort {
createdAt?: SortDirection;
dueDate?: SortDirection;
updatedAt?: SortDirection;
}
export type TaskStatusFilter =
| TaskStatus
| { eq?: TaskStatus; in?: TaskStatus[] };
export interface TaskUpdatePayload {
description?: string | null;
dueDate?: string | null;
priority?: TaskPriority | null;
status?: TaskStatus | null;
title?: string;
}
export interface Task {
archived: boolean | null;
assignee?: User | null;
comments?: Comment[];
createdAt: string;
description: string | null;
dueDate: string | null;
id: string;
priority: TaskPriority | null;
status: TaskStatus | null;
title: string;
updatedAt: string;
}ts
import * as z from 'zod';
export const UserSchema = z.object({
email: z.email(),
id: z.string(),
name: z.string(),
});
export interface User {
email: string;
id: string;
name: string;
}ts
export * from './tasks';ts
import type { OffsetPagination } from '../api';
import type {
Task,
TaskCreatePayload,
TaskFilter,
TaskInclude,
TaskPage,
TaskSort,
TaskUpdatePayload,
} from '../domains/task';
import * as z from 'zod';
import { OffsetPaginationSchema } from '../api';
import {
TaskCreatePayloadSchema,
TaskFilterSchema,
TaskIncludeSchema,
TaskPageSchema,
TaskSchema,
TaskSortSchema,
TaskUpdatePayloadSchema,
} from '../domains/task';
export const TasksIndexRequestQuerySchema = z.object({
filter: z.union([TaskFilterSchema, z.array(TaskFilterSchema)]).optional(),
include: TaskIncludeSchema.optional(),
page: TaskPageSchema.optional(),
sort: z.union([TaskSortSchema, z.array(TaskSortSchema)]).optional(),
});
export const TasksIndexResponseBodySchema = z.object({
meta: z.record(z.string(), z.unknown()).optional(),
pagination: OffsetPaginationSchema,
tasks: z.array(TaskSchema),
});
export const TasksShowPathParamsSchema = z.object({ id: z.string() });
export const TasksShowRequestQuerySchema = z.object({
include: TaskIncludeSchema.optional(),
});
export const TasksShowResponseBodySchema = z.object({
meta: z.record(z.string(), z.unknown()).optional(),
task: TaskSchema,
});
export const TasksCreateRequestQuerySchema = z.object({
include: TaskIncludeSchema.optional(),
});
export const TasksCreateRequestBodySchema = z.object({
task: TaskCreatePayloadSchema,
});
export const TasksCreateResponseBodySchema = z.object({
meta: z.record(z.string(), z.unknown()).optional(),
task: TaskSchema,
});
export const TasksUpdatePathParamsSchema = z.object({ id: z.string() });
export const TasksUpdateRequestQuerySchema = z.object({
include: TaskIncludeSchema.optional(),
});
export const TasksUpdateRequestBodySchema = z.object({
task: TaskUpdatePayloadSchema,
});
export const TasksUpdateResponseBodySchema = z.object({
meta: z.record(z.string(), z.unknown()).optional(),
task: TaskSchema,
});
export const TasksDestroyPathParamsSchema = z.object({ id: z.string() });
export const TasksDestroyRequestQuerySchema = z.object({
include: TaskIncludeSchema.optional(),
});
export const TasksArchivePathParamsSchema = z.object({ id: z.string() });
export const TasksArchiveRequestQuerySchema = z.object({
include: TaskIncludeSchema.optional(),
});
export const TasksArchiveResponseBodySchema = z.object({
meta: z.record(z.string(), z.unknown()).optional(),
task: TaskSchema,
});
export type TasksIndexMethod = 'GET';
export type TasksIndexPath = '/tasks';
export interface TasksIndexRequestQuery {
filter?: TaskFilter | TaskFilter[];
include?: TaskInclude;
page?: TaskPage;
sort?: TaskSort | TaskSort[];
}
export type TasksIndexResponseBody = {
meta?: Record<string, unknown>;
pagination: OffsetPagination;
tasks: Task[];
};
export interface TasksIndexRequest {
query: TasksIndexRequestQuery;
}
export interface TasksIndexResponse {
body: TasksIndexResponseBody;
}
export interface TasksIndex {
method: TasksIndexMethod;
path: TasksIndexPath;
request: TasksIndexRequest;
response: TasksIndexResponse;
}
export type TasksShowMethod = 'GET';
export type TasksShowPath = '/tasks/:id';
export interface TasksShowPathParams {
id: string;
}
export interface TasksShowRequestQuery {
include?: TaskInclude;
}
export type TasksShowResponseBody = {
meta?: Record<string, unknown>;
task: Task;
};
export interface TasksShowRequest {
query: TasksShowRequestQuery;
}
export interface TasksShowResponse {
body: TasksShowResponseBody;
}
export interface TasksShow {
method: TasksShowMethod;
path: TasksShowPath;
pathParams: TasksShowPathParams;
request: TasksShowRequest;
response: TasksShowResponse;
}
export type TasksCreateMethod = 'POST';
export type TasksCreatePath = '/tasks';
export interface TasksCreateRequestQuery {
include?: TaskInclude;
}
export interface TasksCreateRequestBody {
task: TaskCreatePayload;
}
export type TasksCreateResponseBody = {
meta?: Record<string, unknown>;
task: Task;
};
export interface TasksCreateRequest {
body: TasksCreateRequestBody;
query: TasksCreateRequestQuery;
}
export interface TasksCreateResponse {
body: TasksCreateResponseBody;
}
export type TasksCreateErrors = 422;
export interface TasksCreate {
errors: TasksCreateErrors;
method: TasksCreateMethod;
path: TasksCreatePath;
request: TasksCreateRequest;
response: TasksCreateResponse;
}
export type TasksUpdateMethod = 'PATCH';
export type TasksUpdatePath = '/tasks/:id';
export interface TasksUpdatePathParams {
id: string;
}
export interface TasksUpdateRequestQuery {
include?: TaskInclude;
}
export interface TasksUpdateRequestBody {
task: TaskUpdatePayload;
}
export type TasksUpdateResponseBody = {
meta?: Record<string, unknown>;
task: Task;
};
export interface TasksUpdateRequest {
body: TasksUpdateRequestBody;
query: TasksUpdateRequestQuery;
}
export interface TasksUpdateResponse {
body: TasksUpdateResponseBody;
}
export type TasksUpdateErrors = 422;
export interface TasksUpdate {
errors: TasksUpdateErrors;
method: TasksUpdateMethod;
path: TasksUpdatePath;
pathParams: TasksUpdatePathParams;
request: TasksUpdateRequest;
response: TasksUpdateResponse;
}
export type TasksDestroyMethod = 'DELETE';
export type TasksDestroyPath = '/tasks/:id';
export interface TasksDestroyPathParams {
id: string;
}
export interface TasksDestroyRequestQuery {
include?: TaskInclude;
}
export interface TasksDestroyRequest {
query: TasksDestroyRequestQuery;
}
export interface TasksDestroy {
method: TasksDestroyMethod;
path: TasksDestroyPath;
pathParams: TasksDestroyPathParams;
request: TasksDestroyRequest;
}
export type TasksArchiveMethod = 'PATCH';
export type TasksArchivePath = '/tasks/:id/archive';
export interface TasksArchivePathParams {
id: string;
}
export interface TasksArchiveRequestQuery {
include?: TaskInclude;
}
export type TasksArchiveResponseBody = {
meta?: Record<string, unknown>;
task: Task;
};
export interface TasksArchiveRequest {
query: TasksArchiveRequestQuery;
}
export interface TasksArchiveResponse {
body: TasksArchiveResponseBody;
}
export type TasksArchiveErrors = 422;
export interface TasksArchive {
errors: TasksArchiveErrors;
method: TasksArchiveMethod;
path: TasksArchivePath;
pathParams: TasksArchivePathParams;
request: TasksArchiveRequest;
response: TasksArchiveResponse;
}Sorbus
ts
import * as z from 'zod';
export const ErrorLayerSchema = z.enum(['contract', 'domain', 'http']);
export const SortDirectionSchema = z.enum(['asc', 'desc']);
export const ErrorIssueSchema = z.object({
code: z.string(),
detail: z.string(),
meta: z.record(z.string(), z.unknown()),
path: z.array(z.union([z.string(), z.number().int()])),
pointer: z.string(),
});
export const OffsetPaginationSchema = z.object({
current: z.number().int(),
items: z.number().int(),
next: z.number().int().nullable().optional(),
prev: z.number().int().nullable().optional(),
total: z.number().int(),
});
export const ErrorSchema = z.object({
issues: z.array(ErrorIssueSchema),
layer: ErrorLayerSchema,
});
export type ErrorLayer = 'contract' | 'domain' | 'http';
export type SortDirection = 'asc' | 'desc';
export interface ErrorIssue {
code: string;
detail: string;
meta: Record<string, unknown>;
path: string | number[];
pointer: string;
}
export interface OffsetPagination {
current: number;
items: number;
next?: number | null;
prev?: number | null;
total: number;
}
export interface Error {
issues: ErrorIssue[];
layer: ErrorLayer;
}ts
import type { TasksOperationTree } from './endpoints';
import { createClientFactory } from 'sorbus';
import { contract } from './contract';
export interface Client {
tasks: TasksOperationTree;
}
export const createClient = createClientFactory<Client>(contract);ts
import { ErrorSchema } from './api';
import { tasks } from './endpoints';
export const contract = {
endpoints: {
tasks,
},
error: ErrorSchema,
} as const;ts
import * as z from 'zod';
export const CommentSchema = z.object({
authorName: z.string().nullable(),
body: z.string(),
createdAt: z.iso.datetime(),
id: z.string(),
updatedAt: z.iso.datetime(),
});
export interface Comment {
authorName: string | null;
body: string;
createdAt: string;
id: string;
updatedAt: string;
}ts
export * from './comment';
export * from './task';
export * from './user';ts
import type { SortDirection } from '../api';
import type { Comment } from './comment';
import type { User } from './user';
import * as z from 'zod';
import { SortDirectionSchema } from '../api';
import { CommentSchema } from './comment';
import { UserSchema } from './user';
export const TaskPrioritySchema = z.enum(['critical', 'high', 'low', 'medium']);
export const TaskStatusSchema = z.enum([
'archived',
'completed',
'in_progress',
'pending',
]);
export const TaskFilterSchema: z.ZodType<TaskFilter> = z.lazy(() =>
z.object({
AND: z.array(TaskFilterSchema).optional(),
NOT: TaskFilterSchema.optional(),
OR: z.array(TaskFilterSchema).optional(),
priority: TaskPriorityFilterSchema.optional(),
status: TaskStatusFilterSchema.optional(),
}),
);
export const TaskCreatePayloadSchema = z.object({
description: z.string().nullable().default(null),
dueDate: z.iso.datetime().nullable().default(null),
priority: TaskPrioritySchema.nullable().default('medium'),
status: TaskStatusSchema.nullable().default('pending'),
title: z.string(),
});
export const TaskIncludeSchema = z.object({
assignee: z.boolean().optional(),
comments: z.boolean().optional(),
});
export const TaskPageSchema = z.object({
number: z.number().int().min(1).optional(),
size: z.number().int().min(1).max(100).optional(),
});
export const TaskPriorityFilterSchema = z.union([
TaskPrioritySchema,
z
.object({ eq: TaskPrioritySchema, in: z.array(TaskPrioritySchema) })
.partial(),
]);
export const TaskSortSchema = z.object({
createdAt: SortDirectionSchema.optional(),
dueDate: SortDirectionSchema.optional(),
updatedAt: SortDirectionSchema.optional(),
});
export const TaskStatusFilterSchema = z.union([
TaskStatusSchema,
z.object({ eq: TaskStatusSchema, in: z.array(TaskStatusSchema) }).partial(),
]);
export const TaskUpdatePayloadSchema = z.object({
description: z.string().nullable().optional(),
dueDate: z.iso.datetime().nullable().optional(),
priority: TaskPrioritySchema.nullable().optional(),
status: TaskStatusSchema.nullable().optional(),
title: z.string().optional(),
});
export const TaskSchema = z.object({
archived: z.boolean().nullable(),
assignee: UserSchema.nullable().optional(),
comments: z.array(CommentSchema).optional(),
createdAt: z.iso.datetime(),
description: z.string().nullable(),
dueDate: z.iso.datetime().nullable(),
id: z.string(),
priority: TaskPrioritySchema.nullable(),
status: TaskStatusSchema.nullable(),
title: z.string(),
updatedAt: z.iso.datetime(),
});
export type TaskPriority = 'critical' | 'high' | 'low' | 'medium';
export type TaskStatus = 'archived' | 'completed' | 'in_progress' | 'pending';
export interface TaskFilter {
AND?: TaskFilter[];
NOT?: TaskFilter;
OR?: TaskFilter[];
priority?: TaskPriorityFilter;
status?: TaskStatusFilter;
}
export interface TaskCreatePayload {
description?: string | null;
dueDate?: string | null;
priority?: TaskPriority | null;
status?: TaskStatus | null;
title: string;
}
export interface TaskInclude {
assignee?: boolean;
comments?: boolean;
}
export interface TaskPage {
number?: number;
size?: number;
}
export type TaskPriorityFilter =
| TaskPriority
| { eq?: TaskPriority; in?: TaskPriority[] };
export interface TaskSort {
createdAt?: SortDirection;
dueDate?: SortDirection;
updatedAt?: SortDirection;
}
export type TaskStatusFilter =
| TaskStatus
| { eq?: TaskStatus; in?: TaskStatus[] };
export interface TaskUpdatePayload {
description?: string | null;
dueDate?: string | null;
priority?: TaskPriority | null;
status?: TaskStatus | null;
title?: string;
}
export interface Task {
archived: boolean | null;
assignee?: User | null;
comments?: Comment[];
createdAt: string;
description: string | null;
dueDate: string | null;
id: string;
priority: TaskPriority | null;
status: TaskStatus | null;
title: string;
updatedAt: string;
}ts
import * as z from 'zod';
export const UserSchema = z.object({
email: z.email(),
id: z.string(),
name: z.string(),
});
export interface User {
email: string;
id: string;
name: string;
}ts
export * from './tasks';ts
import type { Operation } from 'sorbus';
import type { OffsetPagination } from '../api';
import type {
Task,
TaskCreatePayload,
TaskFilter,
TaskInclude,
TaskPage,
TaskSort,
TaskUpdatePayload,
} from '../domains/task';
import * as z from 'zod';
import { OffsetPaginationSchema } from '../api';
import {
TaskCreatePayloadSchema,
TaskFilterSchema,
TaskIncludeSchema,
TaskPageSchema,
TaskSchema,
TaskSortSchema,
TaskUpdatePayloadSchema,
} from '../domains/task';
export const TasksIndexRequestQuerySchema = z.object({
filter: z.union([TaskFilterSchema, z.array(TaskFilterSchema)]).optional(),
include: TaskIncludeSchema.optional(),
page: TaskPageSchema.optional(),
sort: z.union([TaskSortSchema, z.array(TaskSortSchema)]).optional(),
});
export const TasksIndexResponseBodySchema = z.object({
meta: z.record(z.string(), z.unknown()).optional(),
pagination: OffsetPaginationSchema,
tasks: z.array(TaskSchema),
});
export const TasksShowPathParamsSchema = z.object({ id: z.string() });
export const TasksShowRequestQuerySchema = z.object({
include: TaskIncludeSchema.optional(),
});
export const TasksShowResponseBodySchema = z.object({
meta: z.record(z.string(), z.unknown()).optional(),
task: TaskSchema,
});
export const TasksCreateRequestQuerySchema = z.object({
include: TaskIncludeSchema.optional(),
});
export const TasksCreateRequestBodySchema = z.object({
task: TaskCreatePayloadSchema,
});
export const TasksCreateResponseBodySchema = z.object({
meta: z.record(z.string(), z.unknown()).optional(),
task: TaskSchema,
});
export const TasksUpdatePathParamsSchema = z.object({ id: z.string() });
export const TasksUpdateRequestQuerySchema = z.object({
include: TaskIncludeSchema.optional(),
});
export const TasksUpdateRequestBodySchema = z.object({
task: TaskUpdatePayloadSchema,
});
export const TasksUpdateResponseBodySchema = z.object({
meta: z.record(z.string(), z.unknown()).optional(),
task: TaskSchema,
});
export const TasksDestroyPathParamsSchema = z.object({ id: z.string() });
export const TasksDestroyRequestQuerySchema = z.object({
include: TaskIncludeSchema.optional(),
});
export const TasksArchivePathParamsSchema = z.object({ id: z.string() });
export const TasksArchiveRequestQuerySchema = z.object({
include: TaskIncludeSchema.optional(),
});
export const TasksArchiveResponseBodySchema = z.object({
meta: z.record(z.string(), z.unknown()).optional(),
task: TaskSchema,
});
export type TasksIndexMethod = 'GET';
export type TasksIndexPath = '/tasks';
export interface TasksIndexRequestQuery {
filter?: TaskFilter | TaskFilter[];
include?: TaskInclude;
page?: TaskPage;
sort?: TaskSort | TaskSort[];
}
export type TasksIndexResponseBody = {
meta?: Record<string, unknown>;
pagination: OffsetPagination;
tasks: Task[];
};
export interface TasksIndexRequest {
query: TasksIndexRequestQuery;
}
export interface TasksIndexResponse {
body: TasksIndexResponseBody;
}
export interface TasksIndex {
method: TasksIndexMethod;
path: TasksIndexPath;
request: TasksIndexRequest;
response: TasksIndexResponse;
}
export type TasksShowMethod = 'GET';
export type TasksShowPath = '/tasks/:id';
export interface TasksShowPathParams {
id: string;
}
export interface TasksShowRequestQuery {
include?: TaskInclude;
}
export type TasksShowResponseBody = {
meta?: Record<string, unknown>;
task: Task;
};
export interface TasksShowRequest {
query: TasksShowRequestQuery;
}
export interface TasksShowResponse {
body: TasksShowResponseBody;
}
export interface TasksShow {
method: TasksShowMethod;
path: TasksShowPath;
pathParams: TasksShowPathParams;
request: TasksShowRequest;
response: TasksShowResponse;
}
export type TasksCreateMethod = 'POST';
export type TasksCreatePath = '/tasks';
export interface TasksCreateRequestQuery {
include?: TaskInclude;
}
export interface TasksCreateRequestBody {
task: TaskCreatePayload;
}
export type TasksCreateResponseBody = {
meta?: Record<string, unknown>;
task: Task;
};
export interface TasksCreateRequest {
body: TasksCreateRequestBody;
query: TasksCreateRequestQuery;
}
export interface TasksCreateResponse {
body: TasksCreateResponseBody;
}
export type TasksCreateErrors = 422;
export interface TasksCreate {
errors: TasksCreateErrors;
method: TasksCreateMethod;
path: TasksCreatePath;
request: TasksCreateRequest;
response: TasksCreateResponse;
}
export type TasksUpdateMethod = 'PATCH';
export type TasksUpdatePath = '/tasks/:id';
export interface TasksUpdatePathParams {
id: string;
}
export interface TasksUpdateRequestQuery {
include?: TaskInclude;
}
export interface TasksUpdateRequestBody {
task: TaskUpdatePayload;
}
export type TasksUpdateResponseBody = {
meta?: Record<string, unknown>;
task: Task;
};
export interface TasksUpdateRequest {
body: TasksUpdateRequestBody;
query: TasksUpdateRequestQuery;
}
export interface TasksUpdateResponse {
body: TasksUpdateResponseBody;
}
export type TasksUpdateErrors = 422;
export interface TasksUpdate {
errors: TasksUpdateErrors;
method: TasksUpdateMethod;
path: TasksUpdatePath;
pathParams: TasksUpdatePathParams;
request: TasksUpdateRequest;
response: TasksUpdateResponse;
}
export type TasksDestroyMethod = 'DELETE';
export type TasksDestroyPath = '/tasks/:id';
export interface TasksDestroyPathParams {
id: string;
}
export interface TasksDestroyRequestQuery {
include?: TaskInclude;
}
export interface TasksDestroyRequest {
query: TasksDestroyRequestQuery;
}
export interface TasksDestroy {
method: TasksDestroyMethod;
path: TasksDestroyPath;
pathParams: TasksDestroyPathParams;
request: TasksDestroyRequest;
}
export type TasksArchiveMethod = 'PATCH';
export type TasksArchivePath = '/tasks/:id/archive';
export interface TasksArchivePathParams {
id: string;
}
export interface TasksArchiveRequestQuery {
include?: TaskInclude;
}
export type TasksArchiveResponseBody = {
meta?: Record<string, unknown>;
task: Task;
};
export interface TasksArchiveRequest {
query: TasksArchiveRequestQuery;
}
export interface TasksArchiveResponse {
body: TasksArchiveResponseBody;
}
export type TasksArchiveErrors = 422;
export interface TasksArchive {
errors: TasksArchiveErrors;
method: TasksArchiveMethod;
path: TasksArchivePath;
pathParams: TasksArchivePathParams;
request: TasksArchiveRequest;
response: TasksArchiveResponse;
}
export const tasks = {
archive: {
errors: [422],
method: 'PATCH',
path: '/tasks/:id/archive',
pathParams: TasksArchivePathParamsSchema,
request: {
query: TasksArchiveRequestQuerySchema,
},
response: {
body: TasksArchiveResponseBodySchema,
},
},
create: {
errors: [422],
method: 'POST',
path: '/tasks',
request: {
body: TasksCreateRequestBodySchema,
query: TasksCreateRequestQuerySchema,
},
response: {
body: TasksCreateResponseBodySchema,
},
},
destroy: {
method: 'DELETE',
path: '/tasks/:id',
pathParams: TasksDestroyPathParamsSchema,
request: {
query: TasksDestroyRequestQuerySchema,
},
},
index: {
method: 'GET',
path: '/tasks',
request: {
query: TasksIndexRequestQuerySchema,
},
response: {
body: TasksIndexResponseBodySchema,
},
},
show: {
method: 'GET',
path: '/tasks/:id',
pathParams: TasksShowPathParamsSchema,
request: {
query: TasksShowRequestQuerySchema,
},
response: {
body: TasksShowResponseBodySchema,
},
},
update: {
errors: [422],
method: 'PATCH',
path: '/tasks/:id',
pathParams: TasksUpdatePathParamsSchema,
request: {
body: TasksUpdateRequestBodySchema,
query: TasksUpdateRequestQuerySchema,
},
response: {
body: TasksUpdateResponseBodySchema,
},
},
} as const;
export interface TasksOperationTree {
archive: Operation<TasksArchive>;
create: Operation<TasksCreate>;
destroy: Operation<TasksDestroy>;
index: Operation<TasksIndex>;
show: Operation<TasksShow>;
update: Operation<TasksUpdate>;
}