openapi: 3.2.0 info: title: Operations Hub Work Management.campaigns API version: 0.1.1 description: '' servers: [] tags: - name: work-management.campaigns paths: /api/work-management/campaigns/with-scope: post: operationId: client_work_management_endpoints_campaigns_create_campaign_with_scope summary: Create Campaign With Scope parameters: [] responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/CampaignWithScopeResponse' description: 'Atomically create a Campaign + one WorkPackage per selected park. Productionises AeroCore''s ``create-campaign-with-scope`` Track-2 shim: what was a best-effort sequence of ``POST /campaigns`` + N ``POST /work-packages`` with cleanup-on-failure is now a single transaction (no orphans possible).' tags: - work-management.campaigns requestBody: content: application/json: schema: $ref: '#/components/schemas/CampaignWithScopeCreate' required: true security: - APIKeyAuth: [] - CookieAuth: [] /api/work-management/campaigns: get: operationId: list_campaigns summary: List Campaigns 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: 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/CampaignResponse' title: Response type: array '400': description: Bad Request content: application/json: schema: $ref: '#/components/schemas/Error' description: List all items with optional search, sorting, and pagination. tags: - work-management.campaigns security: - APIKeyAuth: [] - CookieAuth: [] post: operationId: create_campaign summary: Create Campaign parameters: [] responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/CampaignResponse' description: Create a new item. tags: - work-management.campaigns requestBody: content: application/json: schema: $ref: '#/components/schemas/CampaignCreate' required: true security: - APIKeyAuth: [] - CookieAuth: [] /api/work-management/campaigns/{id}: get: operationId: get_campaign summary: Get Campaign parameters: - in: path name: id schema: title: Id type: integer required: true responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/CampaignResponse' description: Get a single item by ID. tags: - work-management.campaigns security: - APIKeyAuth: [] - CookieAuth: [] patch: operationId: update_campaign summary: Update Campaign parameters: - in: path name: id schema: title: Id type: integer required: true responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/CampaignResponse' description: Update an item. tags: - work-management.campaigns requestBody: content: application/json: schema: $ref: '#/components/schemas/CampaignUpdate' required: true security: - APIKeyAuth: [] - CookieAuth: [] delete: operationId: delete_campaign summary: Delete Campaign parameters: - in: path name: id schema: title: Id type: integer required: true responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/Success' description: Soft delete an item. tags: - work-management.campaigns security: - APIKeyAuth: [] - CookieAuth: [] /api/work-management/campaigns/{id}/comments: post: operationId: client_work_management_endpoints_campaigns_add_comment summary: Add Comment 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.campaigns requestBody: content: application/json: schema: $ref: '#/components/schemas/CommentCreate' required: true security: - APIKeyAuth: [] - CookieAuth: [] /api/work-management/campaigns/{id}/comments/{comment_id}: delete: operationId: client_work_management_endpoints_campaigns_delete_comment summary: Delete Comment 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.campaigns security: - APIKeyAuth: [] - CookieAuth: [] /api/work-management/campaigns/{id}/attach: post: operationId: client_work_management_endpoints_campaigns_attach_file summary: Attach File 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.campaigns requestBody: content: application/json: schema: $ref: '#/components/schemas/AttachmentCreate' required: true security: - APIKeyAuth: [] - CookieAuth: [] /api/work-management/campaigns/{id}/detach/{storage_id}: delete: operationId: client_work_management_endpoints_campaigns_detach_file summary: Detach File 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.campaigns security: - APIKeyAuth: [] - CookieAuth: [] components: schemas: CampaignWithScopeResponse: properties: campaign: $ref: '#/components/schemas/NestedCampaign' work_packages: items: $ref: '#/components/schemas/NestedWorkPackage' title: Work Packages type: array required: - campaign - work_packages title: CampaignWithScopeResponse 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 CampaignCreate: additionalProperties: false properties: name: title: Name type: string status: anyOf: - type: string - type: 'null' default: draft title: Status description: anyOf: - type: string - type: 'null' title: Description 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 notes: anyOf: - type: string - type: 'null' title: Notes required: - name title: CampaignCreate type: object 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 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 NestedCampaign: additionalProperties: false properties: id: title: Id type: integer name: title: Name type: string required: - id - name title: NestedCampaign type: object CampaignWithScopeCreate: additionalProperties: false description: 'Create a Campaign pre-scoped to a set of parks in one atomic call. Replaces AeroCore''s best-effort multi-call orchestration (create Campaign, then N WorkPackages, then cleanup-on-failure). One WorkPackage is created per ``location_ids`` entry, each pinned via ``WorkPackage.site``.' properties: name: title: Name type: string status: anyOf: - type: string - type: 'null' default: draft title: Status description: anyOf: - type: string - type: 'null' title: Description due_date: anyOf: - format: date type: string - type: 'null' title: Due Date notes: anyOf: - type: string - type: 'null' title: Notes location_ids: items: type: integer title: Location Ids type: array work_package_status: anyOf: - type: string - type: 'null' default: draft title: Work Package Status vendor_id: anyOf: - type: integer - type: 'null' title: Vendor Id required: - name - location_ids title: CampaignWithScopeCreate 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 CampaignUpdate: properties: name: anyOf: - type: string - type: 'null' title: Name status: anyOf: - type: string - type: 'null' title: Status description: anyOf: - type: string - type: 'null' title: Description 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 notes: anyOf: - type: string - type: 'null' title: Notes title: CampaignUpdate type: object CampaignResponse: properties: id: title: Id type: integer name: title: Name type: string status: title: Status type: string description: anyOf: - type: string - type: 'null' title: Description 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 notes: anyOf: - type: string - type: 'null' title: Notes 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 - name - status - created_at - updated_at title: CampaignResponse type: object CommentCreate: additionalProperties: false properties: body: title: Body type: string required: - body title: CommentCreate 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 ErrorCode: description: Error codes for API errors. enum: - validation - server - auth - unknown - external - generic title: ErrorCode type: string securitySchemes: APIKeyAuth: type: http scheme: bearer CookieAuth: type: apiKey in: cookie name: opshub_prod_sessionid AuthBearer: type: http scheme: bearer