{ "swagger": "2.0", "info": { "title": "apfs file-processing stream tool", "version": "1.0", "contact": { "name": "apfs file-processing project", "url": "https://apfs.io/gateway", "email": "info@apfs.io" } }, "tags": [ { "name": "ServiceAPI" } ], "host": "localhost:9678", "basePath": "/v1", "schemes": [ "http", "https", "wss" ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "paths": { "/v1/head/{id}": { "get": { "summary": "Get object information", "operationId": "ServiceAPI_Head", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/v1SimpleObjectResponse" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "id", "in": "path", "required": true, "type": "string", "pattern": ".+" }, { "name": "name", "description": "The list of possible required files. Will be taked only first existing file", "in": "query", "required": false, "type": "array", "items": { "type": "string" }, "collectionFormat": "multi" }, { "name": "options.withWorkflow", "description": "include bucket workflow manifest", "in": "query", "required": false, "type": "boolean" }, { "name": "options.withState", "description": "include processing state (counters only)", "in": "query", "required": false, "type": "boolean" }, { "name": "options.stateFull", "description": "include full job details (requires with_state=true)", "in": "query", "required": false, "type": "boolean" }, { "name": "nocache", "description": "skip metadb, reload meta.json and refresh cache", "in": "query", "required": false, "type": "boolean" } ], "tags": [ "ServiceAPI" ] } }, "/v1/object": { "post": { "summary": "Upload new file as a stream", "operationId": "ServiceAPI_Upload", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/v1SimpleObjectResponse" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "body", "description": " (streaming inputs)", "in": "body", "required": true, "schema": { "$ref": "#/definitions/v1Data" } } ], "tags": [ "ServiceAPI" ] } }, "/v1/object/{id}": { "get": { "summary": "Get object and data", "operationId": "ServiceAPI_Get", "responses": { "200": { "description": "A successful response.(streaming responses)", "schema": { "type": "object", "properties": { "result": { "$ref": "#/definitions/v1ObjectResponse" }, "error": { "$ref": "#/definitions/rpcStatus" } }, "title": "Stream result of v1ObjectResponse" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "id", "in": "path", "required": true, "type": "string" }, { "name": "name", "description": "The list of possible required files. Will be taked only first existing file", "in": "query", "required": false, "type": "array", "items": { "type": "string" }, "collectionFormat": "multi" }, { "name": "options.withWorkflow", "description": "include bucket workflow manifest", "in": "query", "required": false, "type": "boolean" }, { "name": "options.withState", "description": "include processing state (counters only)", "in": "query", "required": false, "type": "boolean" }, { "name": "options.stateFull", "description": "include full job details (requires with_state=true)", "in": "query", "required": false, "type": "boolean" }, { "name": "nocache", "description": "skip metadb, reload meta.json and refresh cache", "in": "query", "required": false, "type": "boolean" } ], "tags": [ "ServiceAPI" ] }, "delete": { "summary": "Delete file object or subitems", "operationId": "ServiceAPI_Delete", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/v1SimpleResponse" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "id", "in": "path", "required": true, "type": "string", "pattern": ".+" }, { "name": "names", "in": "query", "required": false, "type": "array", "items": { "type": "string" }, "collectionFormat": "multi" } ], "tags": [ "ServiceAPI" ] } }, "/v1/preview/{id}": { "get": { "summary": "Preview returns display bytes and mime type for the object's main file.\nImages return the original file; other types return an embedded SVG icon.", "operationId": "ServiceAPI_Preview", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/v1PreviewResponse" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "id", "in": "path", "required": true, "type": "string", "pattern": ".+" }, { "name": "name", "description": "The list of possible required files. Will be taked only first existing file", "in": "query", "required": false, "type": "array", "items": { "type": "string" }, "collectionFormat": "multi" }, { "name": "options.withWorkflow", "description": "include bucket workflow manifest", "in": "query", "required": false, "type": "boolean" }, { "name": "options.withState", "description": "include processing state (counters only)", "in": "query", "required": false, "type": "boolean" }, { "name": "options.stateFull", "description": "include full job details (requires with_state=true)", "in": "query", "required": false, "type": "boolean" }, { "name": "nocache", "description": "skip metadb, reload meta.json and refresh cache", "in": "query", "required": false, "type": "boolean" } ], "tags": [ "ServiceAPI" ] } }, "/v1/refresh/{id}": { "put": { "summary": "Refresh object and reprocess", "operationId": "ServiceAPI_Refresh", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/v1SimpleResponse" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "id", "in": "path", "required": true, "type": "string", "pattern": ".+" }, { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/ServiceAPIRefreshBody" } } ], "tags": [ "ServiceAPI" ] } }, "/v1/state/watch/{id}": { "get": { "summary": "WatchProcessingState streams processing state updates for an object.\nThe stream ends when the object reaches a terminal state.", "operationId": "ServiceAPI_WatchProcessingState", "responses": { "200": { "description": "A successful response.(streaming responses)", "schema": { "type": "object", "properties": { "result": { "$ref": "#/definitions/v1ProcessingState" }, "error": { "$ref": "#/definitions/rpcStatus" } }, "title": "Stream result of v1ProcessingState" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "id", "in": "path", "required": true, "type": "string", "pattern": ".+" }, { "name": "name", "description": "The list of possible required files. Will be taked only first existing file", "in": "query", "required": false, "type": "array", "items": { "type": "string" }, "collectionFormat": "multi" }, { "name": "options.withWorkflow", "description": "include bucket workflow manifest", "in": "query", "required": false, "type": "boolean" }, { "name": "options.withState", "description": "include processing state (counters only)", "in": "query", "required": false, "type": "boolean" }, { "name": "options.stateFull", "description": "include full job details (requires with_state=true)", "in": "query", "required": false, "type": "boolean" }, { "name": "nocache", "description": "skip metadb, reload meta.json and refresh cache", "in": "query", "required": false, "type": "boolean" } ], "tags": [ "ServiceAPI" ] } }, "/v1/state/{id}": { "get": { "summary": "GetProcessingState returns the current processing state for an object.", "operationId": "ServiceAPI_GetProcessingState", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/v1ProcessingStateResponse" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "id", "in": "path", "required": true, "type": "string", "pattern": ".+" }, { "name": "name", "description": "The list of possible required files. Will be taked only first existing file", "in": "query", "required": false, "type": "array", "items": { "type": "string" }, "collectionFormat": "multi" }, { "name": "options.withWorkflow", "description": "include bucket workflow manifest", "in": "query", "required": false, "type": "boolean" }, { "name": "options.withState", "description": "include processing state (counters only)", "in": "query", "required": false, "type": "boolean" }, { "name": "options.stateFull", "description": "include full job details (requires with_state=true)", "in": "query", "required": false, "type": "boolean" }, { "name": "nocache", "description": "skip metadb, reload meta.json and refresh cache", "in": "query", "required": false, "type": "boolean" } ], "tags": [ "ServiceAPI" ] } }, "/v1/state/{id}/ensure": { "post": { "summary": "EnsureProcessing republishes the current processing status to the status\nstream. If the object is not in a terminal state it enqueues further\nprocessing; if it is terminal the current (final) state is published.", "operationId": "ServiceAPI_EnsureProcessing", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/v1ProcessingStateResponse" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "id", "in": "path", "required": true, "type": "string", "pattern": ".+" }, { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/ServiceAPIEnsureProcessingBody" } } ], "tags": [ "ServiceAPI" ] } }, "/v1/workflow/{group}": { "get": { "summary": "GetWorkflow returns the v2 workflow manifest for a group/bucket.", "operationId": "ServiceAPI_GetWorkflow", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/v1WorkflowResponse" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "group", "in": "path", "required": true, "type": "string" } ], "tags": [ "ServiceAPI" ] }, "put": { "summary": "SetWorkflow stores a v2 workflow manifest for a group/bucket.", "operationId": "ServiceAPI_SetWorkflow", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/v1SimpleResponse" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/rpcStatus" } } }, "parameters": [ { "name": "group", "in": "path", "required": true, "type": "string" }, { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/ServiceAPISetWorkflowBody" } } ], "tags": [ "ServiceAPI" ] } } }, "definitions": { "ServiceAPIEnsureProcessingBody": { "type": "object", "properties": { "name": { "type": "array", "items": { "type": "string" }, "title": "The list of possible required files. Will be taked only first existing file" }, "options": { "$ref": "#/definitions/v1ObjectRequestOptions", "title": "optional; nil = default (no extras)" }, "nocache": { "type": "boolean", "title": "skip metadb, reload meta.json and refresh cache" } } }, "ServiceAPIRefreshBody": { "type": "object", "properties": { "name": { "type": "array", "items": { "type": "string" }, "title": "The list of possible required files. Will be taked only first existing file" }, "options": { "$ref": "#/definitions/v1ObjectRequestOptions", "title": "optional; nil = default (no extras)" }, "nocache": { "type": "boolean", "title": "skip metadb, reload meta.json and refresh cache" } } }, "ServiceAPISetWorkflowBody": { "type": "object", "properties": { "workflow": { "$ref": "#/definitions/v1Workflow" } }, "description": "DataWorkflow is the request body for SetWorkflow RPC." }, "protobufAny": { "type": "object", "properties": { "@type": { "type": "string" } }, "additionalProperties": {} }, "rpcStatus": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" }, "details": { "type": "array", "items": { "type": "object", "$ref": "#/definitions/protobufAny" } } } }, "v1Data": { "type": "object", "properties": { "info": { "$ref": "#/definitions/v1DataCustomID" }, "content": { "$ref": "#/definitions/v1DataContent" }, "tags": { "type": "array", "items": { "type": "string" } } } }, "v1DataContent": { "type": "object", "properties": { "content": { "type": "string", "format": "byte" } } }, "v1DataCustomID": { "type": "object", "properties": { "group": { "type": "string" }, "customId": { "type": "string" }, "overwrite": { "type": "boolean" } } }, "v1ItemMeta": { "type": "object", "properties": { "name": { "type": "string" }, "nameExt": { "type": "string" }, "type": { "type": "string" }, "contentType": { "type": "string" }, "hashId": { "type": "string" }, "width": { "type": "integer", "format": "int32" }, "height": { "type": "integer", "format": "int32" }, "size": { "type": "string", "format": "uint64" }, "duration": { "type": "string", "format": "int64" }, "bitrate": { "type": "string" }, "codec": { "type": "string" }, "extJson": { "type": "string", "title": "deprecated: use attributes_json" }, "status": { "$ref": "#/definitions/v1ObjectStatus" }, "updatedAt": { "type": "string", "format": "int64" }, "path": { "type": "string", "description": "relative path inside object: \"thumbs/1.jpg\"", "title": "New fields (v2):" }, "role": { "type": "string", "title": "job that produced this artifact" }, "attributesJson": { "type": "string", "title": "JSON-encoded map[string]any" } }, "title": "ItemMeta information" }, "v1JobState": { "type": "object", "properties": { "id": { "type": "string" }, "status": { "$ref": "#/definitions/v1JobStatus" }, "worker": { "type": "string" }, "attempts": { "type": "integer", "format": "int32" }, "outputsJson": { "type": "string", "title": "JSON-encoded map[string]any" }, "steps": { "type": "array", "items": { "type": "object", "$ref": "#/definitions/v1StepState" } }, "error": { "type": "string" }, "startedAt": { "type": "string", "format": "int64", "title": "Unix timestamp ms" }, "finishedAt": { "type": "string", "format": "int64" }, "progress": { "type": "number", "format": "float" } }, "description": "JobState is the runtime state of one job in the processing DAG." }, "v1JobStatus": { "type": "string", "enum": [ "JOB_PENDING", "JOB_RUNNING", "JOB_COMPLETED", "JOB_FAILED", "JOB_SKIPPED" ], "default": "JOB_PENDING", "title": "JobStatus enum" }, "v1Meta": { "type": "object", "properties": { "manifestVersion": { "type": "string" }, "main": { "$ref": "#/definitions/v1ItemMeta" }, "items": { "type": "array", "items": { "type": "object", "$ref": "#/definitions/v1ItemMeta" } }, "tags": { "type": "array", "items": { "type": "string" } }, "createdAt": { "type": "string", "format": "int64" }, "updatedAt": { "type": "string", "format": "int64" }, "attributesJson": { "type": "string", "description": "JSON-encoded map[string]any", "title": "New fields (v2):" } }, "title": "Meta information of the file object" }, "v1Object": { "type": "object", "properties": { "id": { "type": "string" }, "bucket": { "type": "string" }, "path": { "type": "string" }, "hashId": { "type": "string" }, "status": { "$ref": "#/definitions/v1ObjectStatus" }, "objectType": { "type": "string" }, "contentType": { "type": "string" }, "meta": { "$ref": "#/definitions/v1Meta" }, "size": { "type": "integer", "format": "int64" }, "createdAt": { "type": "string", "format": "int64" }, "updatedAt": { "type": "string", "format": "int64" }, "workflow": { "$ref": "#/definitions/v1Workflow", "description": "populated when with_workflow=true", "title": "Conditionally populated fields (require ObjectRequestOptions in the request)" }, "state": { "$ref": "#/definitions/v1ProcessingState", "title": "populated when with_state=true" } } }, "v1ObjectRequestOptions": { "type": "object", "properties": { "withWorkflow": { "type": "boolean", "title": "include bucket workflow manifest" }, "withState": { "type": "boolean", "title": "include processing state (counters only)" }, "stateFull": { "type": "boolean", "title": "include full job details (requires with_state=true)" } }, "description": "ObjectRequestOptions controls which optional data is included in the object response." }, "v1ObjectResponse": { "type": "object", "properties": { "response": { "$ref": "#/definitions/v1SimpleObjectResponse" }, "content": { "$ref": "#/definitions/v1DataContent" } } }, "v1ObjectStatus": { "type": "object", "properties": { "status": { "type": "string" }, "message": { "type": "string" } } }, "v1PreviewResponse": { "type": "object", "properties": { "status": { "$ref": "#/definitions/v1ResponseStatusCode" }, "message": { "type": "string" }, "contentType": { "type": "string" }, "content": { "type": "string", "format": "byte" } } }, "v1ProcessingCounters": { "type": "object", "properties": { "total": { "type": "integer", "format": "int32" }, "pending": { "type": "integer", "format": "int32" }, "running": { "type": "integer", "format": "int32" }, "succeeded": { "type": "integer", "format": "int32" }, "failed": { "type": "integer", "format": "int32" }, "skipped": { "type": "integer", "format": "int32" } }, "description": "ProcessingCounters holds aggregate job counts." }, "v1ProcessingState": { "type": "object", "properties": { "objectId": { "type": "string" }, "status": { "$ref": "#/definitions/v1ProcessingStatus" }, "progress": { "type": "number", "format": "float" }, "manifestVersion": { "type": "string" }, "jobs": { "type": "array", "items": { "type": "object", "$ref": "#/definitions/v1JobState" }, "title": "jobs is populated only when state_full=true in ObjectRequestOptions" }, "startedAt": { "type": "string", "format": "int64" }, "updatedAt": { "type": "string", "format": "int64" }, "finishedAt": { "type": "string", "format": "int64" }, "counters": { "$ref": "#/definitions/v1ProcessingCounters", "title": "always populated" } }, "description": "ProcessingState tracks the full execution state of a processing pipeline\nfor a single object." }, "v1ProcessingStateResponse": { "type": "object", "properties": { "status": { "$ref": "#/definitions/v1ResponseStatusCode" }, "message": { "type": "string" }, "state": { "$ref": "#/definitions/v1ProcessingState" } }, "description": "ProcessingStateResponse wraps ProcessingState in a standard response." }, "v1ProcessingStatus": { "type": "string", "enum": [ "PROCESSING_PENDING", "PROCESSING_RUNNING", "PROCESSING_COMPLETED", "PROCESSING_PARTIAL", "PROCESSING_FAILED" ], "default": "PROCESSING_PENDING", "title": "ProcessingStatus enum" }, "v1ResponseStatusCode": { "type": "string", "enum": [ "UNKNOWN_INVALID", "OK", "FAILED", "NOT_FOUND" ], "default": "UNKNOWN_INVALID", "description": "ResponseStatusCode indicates the outcome of an API operation." }, "v1SimpleObjectResponse": { "type": "object", "properties": { "status": { "$ref": "#/definitions/v1ResponseStatusCode" }, "message": { "type": "string" }, "object": { "$ref": "#/definitions/v1Object" } } }, "v1SimpleResponse": { "type": "object", "properties": { "status": { "$ref": "#/definitions/v1ResponseStatusCode" }, "message": { "type": "string" } } }, "v1StepState": { "type": "object", "properties": { "name": { "type": "string" }, "status": { "$ref": "#/definitions/v1StepStatus" }, "durationMs": { "type": "string", "format": "int64" }, "error": { "type": "string" } }, "description": "StepState is the runtime state of one step within a job." }, "v1StepStatus": { "type": "string", "enum": [ "STEP_PENDING", "STEP_RUNNING", "STEP_COMPLETED", "STEP_FAILED", "STEP_SKIPPED" ], "default": "STEP_PENDING", "title": "StepStatus enum" }, "v1Workflow": { "type": "object", "properties": { "version": { "type": "string" }, "name": { "type": "string" }, "description": { "type": "string" }, "contentTypes": { "type": "array", "items": { "type": "string" } }, "tags": { "type": "array", "items": { "type": "string" } }, "keepOriginal": { "type": "boolean" }, "originalName": { "type": "string" }, "validate": { "$ref": "#/definitions/v1WorkflowValidate" }, "jobs": { "type": "array", "items": { "type": "object", "$ref": "#/definitions/v1WorkflowJob" } }, "prime": { "$ref": "#/definitions/v1WorkflowJob", "title": "re-encodes the original before jobs" } }, "description": "Workflow is the top-level v2 manifest." }, "v1WorkflowJob": { "type": "object", "properties": { "id": { "type": "string" }, "runsOn": { "type": "string" }, "needs": { "type": "array", "items": { "type": "string" } }, "timeoutMinutes": { "type": "integer", "format": "int32" }, "onFailure": { "type": "string" }, "ifExpr": { "type": "string", "title": "maps to \"if\" in YAML" }, "steps": { "type": "array", "items": { "type": "object", "$ref": "#/definitions/v1WorkflowStep" } } }, "description": "WorkflowJob is a node in the processing DAG." }, "v1WorkflowResponse": { "type": "object", "properties": { "status": { "$ref": "#/definitions/v1ResponseStatusCode" }, "message": { "type": "string" }, "workflow": { "$ref": "#/definitions/v1Workflow" } }, "description": "WorkflowResponse is the response for GetWorkflow RPC." }, "v1WorkflowStep": { "type": "object", "properties": { "name": { "type": "string" }, "uses": { "type": "string" }, "withJson": { "type": "string", "title": "JSON-encoded map[string]any" }, "run": { "type": "string", "title": "inline script (shell/exec/procedure)" }, "docker": { "$ref": "#/definitions/v1WorkflowStepDocker" } }, "description": "WorkflowStep is a single action within a WorkflowJob." }, "v1WorkflowStepDocker": { "type": "object", "properties": { "image": { "type": "string" }, "pullImage": { "type": "boolean" }, "retainContainer": { "type": "boolean" }, "removeAfterDone": { "type": "boolean" }, "containerName": { "type": "string" } }, "description": "WorkflowStepDocker holds Docker-specific configuration for a step." }, "v1WorkflowValidate": { "type": "object", "properties": { "maxSize": { "type": "string" }, "minSize": { "type": "string" }, "contentTypes": { "type": "array", "items": { "type": "string" } }, "checks": { "type": "array", "items": { "type": "object", "$ref": "#/definitions/v1WorkflowValidateCheck" } } }, "description": "WorkflowValidate defines pre-upload validation rules." }, "v1WorkflowValidateCheck": { "type": "object", "properties": { "name": { "type": "string" }, "uses": { "type": "string" }, "withJson": { "type": "string" } }, "description": "WorkflowValidateCheck is a single validation check." } }, "externalDocs": { "description": "apfs API docs", "url": "https://docs.apfs.io/api" } }