openapi: 3.2.0 info: title: Operations Hub Core.customers.locations API version: 0.1.1 description: '' servers: [] tags: - name: core.customers.locations paths: /api/core/v1/customers/{customer_id}/locations: get: operationId: list_customer_locations summary: List Locations for Customer parameters: - in: path name: customer_id schema: title: Customer Id type: integer required: true - in: query name: search schema: anyOf: - type: string - type: 'null' description: Search by name (case-insensitive) title: Search required: false description: Search by name (case-insensitive) - in: query name: sort schema: anyOf: - type: string - type: 'null' description: Sort by field (prefix with - for descending) title: Sort required: false description: Sort by field (prefix with - for descending) - in: query name: location_id schema: anyOf: - type: integer - type: 'null' description: Filter by location ID title: Location Id required: false description: Filter by location ID - in: query name: relationship_id schema: anyOf: - type: integer - type: 'null' description: Filter by relationship type ID title: Relationship Id required: false description: Filter by relationship type ID - in: query name: type schema: anyOf: - $ref: '#/components/schemas/LocationType' - type: 'null' description: Filter by location type required: false description: Filter by location type - 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/CustomerLocationResponse' title: Response type: array '400': description: Bad Request content: application/json: schema: $ref: '#/components/schemas/Error' description: List all child items for a parent with pagination, search, and sorting. tags: - core.customers.locations security: - APIKeyAuth: [] - CookieAuth: [] post: operationId: create_customer_location summary: Create Location parameters: - in: path name: customer_id schema: title: Customer Id type: integer required: true responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/CustomerLocationResponse' description: Create a new child item for the parent. tags: - core.customers.locations requestBody: content: application/json: schema: $ref: '#/components/schemas/CustomerLocationCreate' required: true security: - APIKeyAuth: [] - CookieAuth: [] /api/core/v1/customers/{customer_id}/locations/{customer_location_id}: get: operationId: get_customer_location summary: Get Location parameters: - in: path name: customer_id schema: title: Customer Id type: integer required: true - in: path name: customer_location_id schema: title: Customer Location Id type: integer required: true responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/CustomerLocationResponse' description: Get a single child item. tags: - core.customers.locations security: - APIKeyAuth: [] - CookieAuth: [] patch: operationId: update_customer_location summary: Update Location parameters: - in: path name: customer_id schema: title: Customer Id type: integer required: true - in: path name: customer_location_id schema: title: Customer Location Id type: integer required: true responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/CustomerLocationResponse' description: Update a child item. tags: - core.customers.locations requestBody: content: application/json: schema: $ref: '#/components/schemas/CustomerLocationUpdate' required: true security: - APIKeyAuth: [] - CookieAuth: [] delete: operationId: delete_customer_location summary: Delete Location parameters: - in: path name: customer_id schema: title: Customer Id type: integer required: true - in: path name: customer_location_id schema: title: Customer Location Id type: integer required: true responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/Success' description: Soft delete a child item. tags: - core.customers.locations security: - APIKeyAuth: [] - CookieAuth: [] components: schemas: CustomerLocationCreateMode: description: Supported create flows for customer locations. enum: - share - create title: CustomerLocationCreateMode type: string LocationObjectWithType: additionalProperties: false description: Nested location object for responses (no timestamps), including type. properties: id: title: Id type: integer name: anyOf: - type: string - type: 'null' title: Name type: anyOf: - $ref: '#/components/schemas/LocationType' - type: 'null' description: Location type required: - id title: LocationObjectWithType type: object CustomerLocationCreate: additionalProperties: false description: Schema for sharing or creating a location in customer context. properties: mode: $ref: '#/components/schemas/CustomerLocationCreateMode' description: 'Create mode: share an existing location or create a new one' location_id: anyOf: - type: integer - type: 'null' description: Existing location ID. Required when mode=share title: Location Id relationship_id: anyOf: - type: integer - type: 'null' description: Relationship type ID. Allowed only when mode=share title: Relationship Id children_relationship_id: anyOf: - type: integer - type: 'null' description: Relationship type ID for auto-created turbine assignments. Required when mode=share title: Children Relationship Id name: anyOf: - minLength: 1 type: string - type: 'null' description: Location name. Required when mode=create title: Name additional_info: anyOf: - type: string - type: 'null' description: Additional information title: Additional Info type: anyOf: - $ref: '#/components/schemas/LocationType' - type: 'null' description: Location type. Required when mode=create windpark_type: anyOf: - type: string - type: 'null' description: Wind park type title: Windpark Type address_line1: anyOf: - minLength: 1 type: string - type: 'null' description: Address line 1. Required when mode=create title: Address Line1 address_line2: anyOf: - type: string - type: 'null' description: Address line 2 title: Address Line2 city: anyOf: - minLength: 1 type: string - type: 'null' description: City. Required when mode=create title: City state_region: anyOf: - type: string - type: 'null' description: State or region title: State Region postal_code: anyOf: - type: string - type: 'null' description: Postal code title: Postal Code country_id: anyOf: - type: integer - type: 'null' description: Country ID. Required when mode=create title: Country Id timezone_id: anyOf: - type: integer - type: 'null' description: Timezone ID. Required when mode=create title: Timezone Id latitude: anyOf: - type: number - type: 'null' description: Latitude coordinate. Required when mode=create title: Latitude longitude: anyOf: - type: number - type: 'null' description: Longitude coordinate. Required when mode=create title: Longitude coordinates: anyOf: - type: string - type: 'null' description: Coordinates string title: Coordinates global_wind_park_db_id: anyOf: - type: integer - type: 'null' description: Global wind park database ID title: Global Wind Park Db Id certificates: anyOf: - items: $ref: '#/components/schemas/LocationCertificateInput' type: array - type: 'null' description: Required certificates for the location title: Certificates custom_fields: anyOf: - type: object - type: 'null' description: 'Site-specific attributes for the new location (mode=create only). Canonical keys: terrain_type, terrain_details, ground_conditions, regulations, operational_limitations' title: Custom Fields required: - mode title: CustomerLocationCreate type: object LocationCertificateInput: additionalProperties: false description: Input schema for location certificate in create/update requests. properties: certificate_id: description: Certificate ID title: Certificate Id type: integer is_mandatory: default: false description: Whether certificate is mandatory title: Is Mandatory type: boolean required: - certificate_id title: LocationCertificateInput type: object LocationType: description: Allowed location type values in location. enum: - WIND_PARK - WAREHOUSE - SERVICE_HUB - PORT - TRAINING_CENTER - FACTORY - OFFICE title: LocationType type: string 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 RelationshipTypeObject: additionalProperties: false description: Nested relationship type object for responses (no timestamps). properties: id: title: Id type: integer code: title: Code type: string description: anyOf: - type: string - type: 'null' title: Description required: - id - code title: RelationshipTypeObject type: object CustomerLocationUpdate: additionalProperties: false description: Schema for updating a CustomerLocation. properties: location_id: anyOf: - type: integer - type: 'null' description: Location ID title: Location Id relationship_id: anyOf: - type: integer - type: 'null' description: Relationship type ID title: Relationship Id title: CustomerLocationUpdate 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 CustomerLocationResponse: additionalProperties: false description: Schema for CustomerLocation response. properties: updated_at: description: Last update timestamp format: date-time title: Updated At type: string id: description: Customer location ID title: Id type: integer customer_id: description: Customer ID title: Customer Id type: integer location: $ref: '#/components/schemas/LocationObjectWithType' description: Location information relationship: anyOf: - $ref: '#/components/schemas/RelationshipTypeObject' - type: 'null' description: Relationship type information required: - updated_at - id - customer_id - location title: CustomerLocationResponse 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