openapi: 3.2.0 info: title: Operations Hub Work Management.client Work Orders API version: 0.1.1 description: '' servers: [] tags: - name: work-management.client-work-orders paths: /api/work-management/client-work-orders: get: operationId: client_work_management_endpoints_client_work_orders_list_work_orders summary: List Client Work Orders parameters: - in: query name: search schema: anyOf: - type: string - type: 'null' title: Search required: false - in: query name: sort schema: anyOf: - type: string - type: 'null' title: Sort required: false - in: query name: status schema: anyOf: - type: string - type: 'null' title: Status required: false - in: query name: task_type schema: anyOf: - type: string - type: 'null' title: Task Type required: false - in: query name: priority schema: anyOf: - type: string - type: 'null' title: Priority required: false - in: query name: vendor_id schema: anyOf: - type: integer - type: 'null' title: Vendor Id required: false - in: query name: campaign_id schema: anyOf: - type: integer - type: 'null' title: Campaign Id required: false - in: query name: work_package_id schema: anyOf: - type: integer - type: 'null' title: Work Package Id required: false - in: query name: anomaly_id schema: anyOf: - type: integer - type: 'null' title: Anomaly Id required: false - in: query name: site_id schema: anyOf: - type: integer - type: 'null' title: Site Id required: false - in: query name: turbine_id schema: anyOf: - type: integer - type: 'null' title: Turbine Id required: false - in: query name: turbine_component_id schema: anyOf: - type: integer - type: 'null' title: Turbine Component Id required: false - in: query name: unassigned schema: anyOf: - type: boolean - type: 'null' title: Unassigned required: false - in: query name: paginate schema: default: true description: Enable pagination (false returns all results) title: Paginate type: boolean required: false description: Enable pagination (false returns all results) - in: query name: page schema: default: 1 description: Page number minimum: 1 title: Page type: integer required: false description: Page number - in: query name: page_size schema: default: 50 description: Number of items per page maximum: 1000 minimum: 1 title: Page Size type: integer required: false description: Number of items per page responses: '200': description: OK content: application/json: schema: items: $ref: '#/components/schemas/ClientWorkOrderResponse' title: Response type: array '400': description: Bad Request content: application/json: schema: $ref: '#/components/schemas/Error' tags: - work-management.client-work-orders security: - APIKeyAuth: [] - CookieAuth: [] post: operationId: client_work_management_endpoints_client_work_orders_create_work_order summary: Create Client Work Order parameters: [] responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/ClientWorkOrderResponse' tags: - work-management.client-work-orders requestBody: content: application/json: schema: $ref: '#/components/schemas/ClientWorkOrderCreate' required: true security: - APIKeyAuth: [] - CookieAuth: [] /api/work-management/client-work-orders/{id}: get: operationId: client_work_management_endpoints_client_work_orders_get_work_order summary: Get Client Work Order parameters: - in: path name: id schema: title: Id type: integer required: true responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/ClientWorkOrderResponse' tags: - work-management.client-work-orders security: - APIKeyAuth: [] - CookieAuth: [] patch: operationId: client_work_management_endpoints_client_work_orders_update_work_order summary: Update Client Work Order parameters: - in: path name: id schema: title: Id type: integer required: true responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/ClientWorkOrderResponse' tags: - work-management.client-work-orders requestBody: content: application/json: schema: $ref: '#/components/schemas/ClientWorkOrderUpdate' required: true security: - APIKeyAuth: [] - CookieAuth: [] delete: operationId: client_work_management_endpoints_client_work_orders_delete_work_order summary: Delete Client Work Order parameters: - in: path name: id schema: title: Id type: integer required: true responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/Success' tags: - work-management.client-work-orders security: - APIKeyAuth: [] - CookieAuth: [] /api/work-management/client-work-orders/complete: post: operationId: client_work_management_endpoints_client_work_orders_complete_work_orders summary: Complete Work Orders (and cascade linked anomalies) parameters: [] responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/CompleteWorkOrdersResponse' description: 'Atomically complete each work order and advance its linked anomaly. Productionises AECP-333 (pairs the portal''s AECP-329 two-call orchestration): per work order, in one transaction, set ``status=completed`` (stamping ``completed_date``) and — if it has a linked anomaly — advance that anomaly''s ``stage`` -> ``RESOLUTION_COMPLETE`` (which recomputes ``resolution_status`` -> ``RESOLVED``). A WO with no anomaly completes with ``cascade="none"``; if a WO''s cascade fails, that WO rolls back (``cascade="failed"``) while the others still succeed. Gated on work-management-manage; the cascade is RLS-scoped, so it can only advance anomalies the caller''s customer owns.' tags: - work-management.client-work-orders requestBody: content: application/json: schema: $ref: '#/components/schemas/CompleteWorkOrdersPayload' required: true security: - APIKeyAuth: [] - CookieAuth: [] /api/work-management/client-work-orders/{id}/comments: post: operationId: client_work_management_endpoints_client_work_orders_add_comment summary: Add Comment to Work Order parameters: - in: path name: id schema: title: Id type: integer required: true responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/CommentResponse' tags: - work-management.client-work-orders requestBody: content: application/json: schema: $ref: '#/components/schemas/CommentCreate' required: true security: - APIKeyAuth: [] - CookieAuth: [] /api/work-management/client-work-orders/{id}/comments/{comment_id}: delete: operationId: client_work_management_endpoints_client_work_orders_delete_comment summary: Delete Comment from Work Order parameters: - in: path name: id schema: title: Id type: integer required: true - in: path name: comment_id schema: title: Comment Id type: integer required: true responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/Success' tags: - work-management.client-work-orders security: - APIKeyAuth: [] - CookieAuth: [] /api/work-management/client-work-orders/{id}/attach: post: operationId: client_work_management_endpoints_client_work_orders_attach_file summary: Attach File to Work Order parameters: - in: path name: id schema: title: Id type: integer required: true responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/AttachmentResponse' tags: - work-management.client-work-orders requestBody: content: application/json: schema: $ref: '#/components/schemas/AttachmentCreate' required: true security: - APIKeyAuth: [] - CookieAuth: [] /api/work-management/client-work-orders/{id}/detach/{storage_id}: delete: operationId: client_work_management_endpoints_client_work_orders_detach_file summary: Detach File from Work Order parameters: - in: path name: id schema: title: Id type: integer required: true - in: path name: storage_id schema: title: Storage Id type: string required: true responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/Success' tags: - work-management.client-work-orders security: - APIKeyAuth: [] - CookieAuth: [] /api/work-management/client-work-orders/{id}/apply-template: post: operationId: client_work_management_endpoints_client_work_orders_apply_template summary: Apply Activity Template to Work Order parameters: - in: path name: id schema: title: Id type: integer required: true responses: '200': description: OK content: application/json: schema: items: $ref: '#/components/schemas/CwmActivityResponse' title: Response type: array tags: - work-management.client-work-orders requestBody: content: application/json: schema: $ref: '#/components/schemas/CwmApplyTemplatePayload' required: true security: - APIKeyAuth: [] - CookieAuth: [] components: schemas: NestedWorkPackage: additionalProperties: false properties: id: title: Id type: integer name: title: Name type: string campaign: anyOf: - $ref: '#/components/schemas/NestedCampaign' - type: 'null' required: - id - name title: NestedWorkPackage type: object ClientWorkOrderResponse: properties: id: title: Id type: integer number: anyOf: - type: string - type: 'null' title: Number task_type: title: Task Type type: string status: title: Status type: string priority: anyOf: - type: string - type: 'null' title: Priority description: anyOf: - type: string - type: 'null' title: Description notes: anyOf: - type: string - type: 'null' title: Notes start_date: anyOf: - format: date type: string - type: 'null' title: Start Date due_date: anyOf: - format: date type: string - type: 'null' title: Due Date completed_date: anyOf: - format: date type: string - type: 'null' title: Completed Date anomaly_id: anyOf: - type: integer - type: 'null' title: Anomaly Id site_id: anyOf: - type: integer - type: 'null' title: Site Id site: anyOf: - $ref: '#/components/schemas/NestedSite' - type: 'null' turbine_id: anyOf: - type: integer - type: 'null' title: Turbine Id turbine: anyOf: - $ref: '#/components/schemas/NestedTurbine' - type: 'null' turbine_component_id: anyOf: - type: integer - type: 'null' title: Turbine Component Id turbine_component: anyOf: - $ref: '#/components/schemas/NestedTurbineComponent' - type: 'null' campaign_id: anyOf: - type: integer - type: 'null' title: Campaign Id campaign: anyOf: - $ref: '#/components/schemas/NestedCampaign' - type: 'null' work_package_id: anyOf: - type: integer - type: 'null' title: Work Package Id work_package: anyOf: - $ref: '#/components/schemas/NestedWorkPackage' - type: 'null' vendor_id: anyOf: - type: integer - type: 'null' title: Vendor Id vendor: anyOf: - $ref: '#/components/schemas/NestedVendor' - type: 'null' activities: default: [] items: $ref: '#/components/schemas/CwmActivityResponse' title: Activities type: array comments: default: [] items: $ref: '#/components/schemas/CommentResponse' title: Comments type: array attachments: default: [] items: $ref: '#/components/schemas/AttachmentResponse' title: Attachments type: array created_at: format: date-time title: Created At type: string updated_at: format: date-time title: Updated At type: string required: - id - task_type - status - created_at - updated_at title: ClientWorkOrderResponse type: object AttachmentResponse: additionalProperties: false properties: id: title: Id type: integer storage_id: title: Storage Id type: string file_name: default: '' title: File Name type: string file_type: default: '' title: File Type type: string required: - id - storage_id title: AttachmentResponse type: object CommentResponse: additionalProperties: false properties: id: title: Id type: integer body: title: Body type: string created_at: anyOf: - format: date-time type: string - type: 'null' title: Created At created_by_id: anyOf: - type: integer - type: 'null' title: Created By Id required: - id - body title: CommentResponse type: object Success: additionalProperties: false description: 'Schema returned for successful operations. The `success` field is always ``true`` in this schema. Failed operations are represented by the :class:`Error` schema instead, so a ``false`` value does not occur in practice. The field is included for consistency across responses and to make the contract explicit for clients.' properties: success: default: true description: Always true for this schema. Errors are represented by a separate Error schema, so false is never returned. title: Success type: boolean title: Success type: object ClientWorkOrderUpdate: properties: task_type: anyOf: - type: string - type: 'null' title: Task Type status: anyOf: - type: string - type: 'null' title: Status number: anyOf: - type: string - type: 'null' title: Number priority: anyOf: - type: string - type: 'null' title: Priority description: anyOf: - type: string - type: 'null' title: Description notes: anyOf: - type: string - type: 'null' title: Notes start_date: anyOf: - format: date type: string - type: 'null' title: Start Date due_date: anyOf: - format: date type: string - type: 'null' title: Due Date completed_date: anyOf: - format: date type: string - type: 'null' title: Completed Date campaign_id: anyOf: - type: integer - type: 'null' title: Campaign Id work_package_id: anyOf: - type: integer - type: 'null' title: Work Package Id vendor_id: anyOf: - type: integer - type: 'null' title: Vendor Id anomaly_id: anyOf: - type: integer - type: 'null' title: Anomaly Id site_id: anyOf: - type: integer - type: 'null' title: Site Id turbine_id: anyOf: - type: integer - type: 'null' title: Turbine Id turbine_component_id: anyOf: - type: integer - type: 'null' title: Turbine Component Id title: ClientWorkOrderUpdate type: object ErrorCode: description: Error codes for API errors. enum: - validation - server - auth - unknown - external - generic title: ErrorCode type: string NestedTurbine: additionalProperties: false properties: id: title: Id type: integer name: anyOf: - type: string - type: 'null' title: Name required: - id title: NestedTurbine type: object CwmActivityResponse: properties: id: title: Id type: integer client_work_order_id: title: Client Work Order Id type: integer name: anyOf: - type: string - type: 'null' title: Name completed: default: false title: Completed type: boolean description: anyOf: - type: string - type: 'null' title: Description due_date: anyOf: - format: date type: string - type: 'null' title: Due Date completed_date: anyOf: - format: date type: string - type: 'null' title: Completed Date position: anyOf: - type: integer - type: 'null' title: Position custom_fields: default: [] items: {} title: Custom Fields type: array comments: default: [] items: $ref: '#/components/schemas/CommentResponse' title: Comments type: array attachments: default: [] items: $ref: '#/components/schemas/AttachmentResponse' title: Attachments type: array updated_at: format: date-time title: Updated At type: string required: - id - client_work_order_id - updated_at title: CwmActivityResponse type: object CompleteWorkOrdersResponse: additionalProperties: false properties: results: items: $ref: '#/components/schemas/CompleteWorkOrderResult' title: Results type: array required: - results title: CompleteWorkOrdersResponse type: object CwmApplyTemplatePayload: additionalProperties: false properties: template_id: title: Template Id type: integer required: - template_id title: CwmApplyTemplatePayload type: object NestedTurbineComponent: additionalProperties: false properties: id: title: Id type: integer serial_number: anyOf: - type: string - type: 'null' title: Serial Number required: - id title: NestedTurbineComponent type: object CompleteWorkOrdersPayload: additionalProperties: false description: Mark one or more work orders complete (+ cascade linked anomalies). properties: work_order_ids: items: type: integer title: Work Order Ids type: array completed_date: anyOf: - format: date type: string - type: 'null' title: Completed Date required: - work_order_ids title: CompleteWorkOrdersPayload type: object NestedSite: additionalProperties: false properties: id: title: Id type: integer name: title: Name type: string required: - id - name title: NestedSite type: object Error: additionalProperties: false description: Error response schema. properties: code: $ref: '#/components/schemas/ErrorCode' message: title: Message type: string required: - code - message title: Error type: object NestedVendor: additionalProperties: false properties: id: title: Id type: integer name: title: Name type: string required: - id - name title: NestedVendor type: object CompleteWorkOrderResult: description: Per-work-order outcome of the atomic complete + cascade (AECP-333). properties: id: title: Id type: integer status_updated: title: Status Updated type: boolean cascade: title: Cascade type: string anomaly_id: anyOf: - type: integer - type: 'null' title: Anomaly Id error: anyOf: - type: string - type: 'null' title: Error required: - id - status_updated - cascade title: CompleteWorkOrderResult type: object NestedCampaign: additionalProperties: false properties: id: title: Id type: integer name: title: Name type: string required: - id - name title: NestedCampaign type: object AttachmentCreate: additionalProperties: false properties: storage_id: title: Storage Id type: string file_name: anyOf: - type: string - type: 'null' default: '' title: File Name file_type: anyOf: - type: string - type: 'null' default: '' title: File Type required: - storage_id title: AttachmentCreate type: object CommentCreate: additionalProperties: false properties: body: title: Body type: string required: - body title: CommentCreate type: object ClientWorkOrderCreate: additionalProperties: false properties: task_type: title: Task Type type: string status: anyOf: - type: string - type: 'null' default: draft title: Status number: anyOf: - type: string - type: 'null' title: Number priority: anyOf: - type: string - type: 'null' title: Priority description: anyOf: - type: string - type: 'null' title: Description notes: anyOf: - type: string - type: 'null' title: Notes start_date: anyOf: - format: date type: string - type: 'null' title: Start Date due_date: anyOf: - format: date type: string - type: 'null' title: Due Date completed_date: anyOf: - format: date type: string - type: 'null' title: Completed Date campaign_id: anyOf: - type: integer - type: 'null' title: Campaign Id work_package_id: anyOf: - type: integer - type: 'null' title: Work Package Id vendor_id: anyOf: - type: integer - type: 'null' title: Vendor Id anomaly_id: anyOf: - type: integer - type: 'null' title: Anomaly Id site_id: anyOf: - type: integer - type: 'null' title: Site Id turbine_id: anyOf: - type: integer - type: 'null' title: Turbine Id turbine_component_id: anyOf: - type: integer - type: 'null' title: Turbine Component Id template_id: anyOf: - type: integer - type: 'null' title: Template Id required: - task_type title: ClientWorkOrderCreate type: object securitySchemes: APIKeyAuth: type: http scheme: bearer CookieAuth: type: apiKey in: cookie name: opshub_prod_sessionid AuthBearer: type: http scheme: bearer