Metadata-Version: 2.4
Name: mesh-sync-worker-backend-client
Version: 4.0.24.dev5120260312134313
Summary: Auto-generated Python client for Mesh-Sync worker-backend
Home-page: https://github.com/Mesh-Sync/worker-backend
Author: Mesh-Sync
Author-email: 
License: ISC
Project-URL: Homepage, https://github.com/Mesh-Sync/worker-backend
Project-URL: Bug Reports, https://github.com/Mesh-Sync/worker-backend/issues
Project-URL: Source, https://github.com/Mesh-Sync/worker-backend
Keywords: worker,job-queue,bullmq,client,mesh-sync
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Requires-Dist: requests>=2.31.0
Requires-Dist: pydantic>=2.0.0
Dynamic: home-page
Dynamic: requires-python

# Worker Backend Client (Python)

Auto-generated Python client library for the Mesh-Sync worker-backend.

## Installation

### From PyPI (public registry)

```bash
pip install mesh-sync-worker-backend-client
```

### From source (development)

```bash
# Clone the repository and navigate to the generated Python client
cd generated/python

# Install in editable mode
pip install -e .
```

### From TestPyPI (testing)

```bash
pip install --index-url https://test.pypi.org/simple/ mesh-sync-worker-backend-client
```

### From a private PyPI registry (For Private Packages)

**Note:** GitHub Packages does not support Python/PyPI packages. For private Python packages, use a private PyPI registry.

Configure your `pip.conf` or `~/.pypirc`:

**For pip.conf (Linux/Mac: `~/.config/pip/pip.conf`, Windows: `%APPDATA%\pip\pip.ini`):**

```ini
[global]
index-url = https://your-registry.example.com/simple
```

**For authentication with .pypirc (`~/.pypirc`):**

```ini
[distutils]
index-servers =
    private

[private]
repository = https://your-registry.example.com
username = your_username
password = your_password
```

Then install:

```bash
pip install mesh-sync-worker-backend-client
```

## Usage

### Basic Example

```python
from worker_client import WorkerClient

# Initialize client
client = WorkerClient(
    base_url='http://localhost:3000',
    api_key='your_api_key',  # Optional
    timeout=30  # Optional, default 30s
)

# Type-safe method call
job = client.file_download_request({
    'url': 'https://example.com/file.pdf',
    'destination': '/downloads/file.pdf'
})

print(f'Job created: {job.job_id}')

# Check job status
status = client.get_job_status(job.job_id)
print(f'Job state: {status.state}')

# Close the client session
client.close()
```

### Using Context Manager

```python
from worker_client import WorkerClient

with WorkerClient(base_url='http://localhost:3000') as client:
    job = client.file_download_request({
        'url': 'https://example.com/file.pdf',
        'destination': '/downloads/file.pdf'
    })
    print(f'Job ID: {job.job_id}')
```

### Using Message Type Constants

```python
from worker_client import WorkerClient, MessageTypes

client = WorkerClient(base_url='http://localhost:3000')

# Dynamic message type
job = client.send_to_queue(MessageTypes.FILE_DOWNLOAD_REQUEST, {
    'url': 'https://example.com/file.pdf',
    'destination': '/downloads/file.pdf'
})
```

## Available Message Types


### analytics-collection-request

**Description:** Request to trigger a manual market data collection job.
Used for ad-hoc scraping of specific queries on marketplaces.


**Method:** `client.analytics_collection_request(data, opts=None)`

**Payload Type:** `AnalyticsCollectionRequestMessage`

**Fields:**

- `marketplace` (string) [✗]: The marketplace to scrape (etsy, ebay, etc.)

- `query` (string) [✓]: The search query to use

- `options` (object) [✗]: Collection options (pages, filters, etc.)



### backend-logging-event

**Description:** Centralized logging event for capturing all warn/error/failure logs from meshsync-backend.
This event is sent to ELK for centralized monitoring, alerting, and debugging.

Automatically emitted by the custom Pino logger interceptor when:
- logger.warn() is called
- logger.error() is called
- uncaught exceptions occur
- request failures happen (4xx, 5xx responses)

Used for:
- System health monitoring
- Error tracking and alerting
- Performance degradation detection
- Security incident tracking
- Compliance and audit trails


**Method:** `client.backend_logging_event(data, opts=None)`

**Payload Type:** `BackendLoggingEventMessage`

**Fields:**

- `eventType` (string) [✓]: Type of logging event

- `timestamp` (string) [✓]: ISO 8601 timestamp when the log was generated

- `level` (string) [✓]: Log level severity

- `message` (string) [✓]: Human-readable log message

- `context` (string) [✓]: Logger context (typically the class/service name)

- `requestId` (string) [✗]: Unique request ID for correlation (X-Request-Id header)

- `userId` (string) [✗]: ID of the authenticated user (if available)

- `httpMethod` (string) [✗]: HTTP method of the request

- `httpUrl` (string) [✗]: Request URL path (without query params for privacy)

- `httpStatusCode` (integer) [✗]: HTTP response status code

- `errorType` (string) [✗]: Error class/type name

- `errorStack` (string) [✗]: Stack trace (sanitized, no sensitive data)

- `errorCode` (string) [✗]: Application-specific error code for categorization

- `metadata` (object) [✗]: Additional structured context (sanitized, no PII)

- `environment` (string) [✗]: Deployment environment

- `serviceVersion` (string) [✗]: Backend service version

- `hostname` (string) [✗]: Server hostname/pod name

- `durationMs` (number) [✗]: Operation duration in milliseconds (if applicable)



### etsy-analytics-sync-completed

**Description:** Contains synced analytics data for Etsy listings. Backend stores this in etsy_analytics_snapshots table and indexes to ELK.


**Method:** `client.etsy_analytics_sync_completed(data, opts=None)`

**Payload Type:** `EtsyAnalyticsSyncCompletedMessage`

**Fields:**

- `originalJobId` (string) [✗]: 

- `status` (string) [✗]: 

- `syncedCount` (integer) [✗]: Number of listings successfully synced

- `errorCount` (integer) [✗]: Number of listings that failed

- `results` (array) [✗]: Analytics for each synced listing

- `credentialUpdate` (object) [✗]: New credentials if token was refreshed during operation

- `errors` (array) [✗]: Errors for failed listings

- `syncedAt` (string) [✗]: 

- `nextScheduledSync` (string) [✗]: When next automatic sync should occur



### etsy-analytics-sync-request

**Description:** Syncs analytics data from Etsy API for one or more listings. Fetches views, favorites, sales, revenue, and traffic source data.
Can sync: - Specific listings (provide listingIds) - All user listings (provide userId, empty listingIds) - Shop-level analytics (provide shopId)


**Method:** `client.etsy_analytics_sync_request(data, opts=None)`

**Payload Type:** `EtsyAnalyticsSyncRequestMessage`

**Fields:**

- `listingIds` (array) [✗]: Internal listing IDs to sync. Empty = sync all for user.

- `userId` (string) [✗]: User whose listings to sync (if listingIds empty)

- `shopId` (string) [✗]: Etsy shop ID for shop-level analytics

- `credentials` (object) [✗]: Etsy OAuth credentials

- `timeRange` (object) [✗]: Date range for historical analytics

- `syncOptions` (object) [✗]: 

- `etsyCredentials` (object) [✗]: Encrypted Etsy OAuth credentials

- `webhookUrl` (string) [✗]: 



### etsy-publish-listing-completed

**Description:** Indicates completion of Etsy listing publication. Contains external Etsy listing ID and URL, or error details if failed.


**Method:** `client.etsy_publish_listing_completed(data, opts=None)`

**Payload Type:** `EtsyPublishListingCompletedMessage`

**Fields:**

- `originalJobId` (string) [✗]: BullMQ job ID from request

- `listingId` (string) [✗]: Internal marketplace_items ID

- `metamodelId` (string) [✗]: Metamodel that was published

- `materialName` (string) [✗]: Material variant name

- `status` (string) [✗]: Publication result

- `etsyListingId` (string) [✗]: External Etsy listing ID (only if status=SUCCESS)

- `etsyListingUrl` (string) [✗]: URL to view listing on Etsy (only if status=SUCCESS)

- `credentialUpdate` (object) [✗]: New credentials if token was refreshed during operation

- `etsyFileId` (string) [✗]: Etsy digital file ID (only if status=SUCCESS)

- `error` (object) [✗]: Error details (only if status=FAILED)

- `publishedAt` (string) [✗]: When the listing was created (only if status=SUCCESS)

- `processingDuration` (integer) [✗]: Processing time in milliseconds



### etsy-publish-listing-request

**Description:** Publishes a single metamodel listing to Etsy for a specific material variant. Creates Etsy listing, uploads digital file, and returns external listing ID.
This message is enqueued for EACH material variant when publishing a metamodel.
Example: Publishing a metamodel with PLA, Resin, ABS materials creates 3 jobs.


**Method:** `client.etsy_publish_listing_request(data, opts=None)`

**Payload Type:** `EtsyPublishListingRequestMessage`

**Fields:**

- `listingId` (string) [✗]: Internal marketplace_items table ID

- `metamodelId` (string) [✗]: Metamodel being published

- `ownerId` (string) [✗]: User ID who owns the metamodel

- `credentials` (object) [✗]: Etsy OAuth credentials

- `materialVariant` (object) [✗]: Material-specific listing configuration

- `baseListingData` (object) [✗]: Common listing information

- `publishOptions` (object) [✗]: 

- `etsyCredentials` (object) [✗]: Encrypted Etsy OAuth credentials

- `fileMetadata` (object) [✗]: Digital file to upload

- `webhookUrl` (string) [✗]: Callback URL for completion notification



### file-download-completed

**Description:** Notifies that a file download has been processed, indicating success or failure.

**Method:** `client.file_download_completed(data, opts=None)`

**Payload Type:** `FileDownloadCompletedMessage`

**Fields:**

- `originalJobId` (string) [✗]: The ID of the initial 'file-download-request' job this event corresponds to.

- `modelId` (string) [✗]: The unique identifier for the downloaded model.

- `status` (string) [✗]: The final status of the download operation.

- `s3Location` (object) [✗]: Details of the file's location in Minio S3 (present on success).

- `errorMessage` (string) [✗]: Contains error details if the status is FAILED.

- `downloadedAt` (string) [✗]: The timestamp when the download was completed or failed.



### file-download-request

**Description:** Downloads model file from storage provider to MinIO for processing pipeline. 
Acts as parent job for thumbnail generation, technical metadata analysis, and metadata generation.

Retry Configuration:
- Automatic retry enabled for transient failures (connection errors, timeouts)
- Default: 5 attempts with exponential backoff (2s, 4s, 8s, 16s, 32s)
- Retry on: STORAGE_TIMEOUT, NETWORK_ERROR, MINIO_UNAVAILABLE, CONNECTION_REFUSED
- No retry on: INVALID_CREDENTIALS, FILE_NOT_FOUND, PERMISSION_DENIED


**Method:** `client.file_download_request(data, opts=None)`

**Payload Type:** `FileDownloadRequestMessage`

**Fields:**

- `modelId` (string) [✗]: The unique identifier for the model to be downloaded.

- `ownerId` (string) [✗]: The identifier of the user who owns the model. Optional - if not provided, will be retrieved from StorageConnection.

- `storageLocation` (object) [✗]: The storage location of the model.

- `metadata` (object) [✗]: Optional metadata from discovery. For Thingiverse, contains downloadUrl for direct file access.

- `credentials` (object) [✗]: Decrypted credentials required for this specific download operation. Injected by the backend.

- `minioDestination` (object) [✗]: Destination in MinIO where file will be uploaded after download.

- `autoEnqueueChildren` (boolean) [✗]: Automatically enqueue thumbnail generation, technical metadata analysis, and metadata generation jobs after download completes.

- `previewType` (string) [✗]: Preview type for thumbnail generation (passed to child job).

- `generate360Views` (boolean) [✗]: Generate 16 angle views for 360° preview (passed to child job).

- `webhookUrl` (string) [✗]: Optional webhook URL to call when download completes. If provided, worker will POST completion status to this endpoint.



### file-vectorize-completed

**Description:** Result of the vectorization process containing the embedding vector.

**Method:** `client.file_vectorize_completed(data, opts=None)`

**Payload Type:** `FileVectorizeCompletedMessage`

**Fields:**

- `fileId` (string) [✗]: 

- `vector` (array) [✗]: The computed embedding vector

- `modelName` (string) [✗]: 

- `dimension` (integer) [✗]: Length of the vector (e.g., 512)



### file-vectorize-request

**Description:** Request to generate a vector embedding for an image file using CLIP.

**Method:** `client.file_vectorize_request(data, opts=None)`

**Payload Type:** `FileVectorizeRequestMessage`

**Fields:**

- `fileId` (string) [✗]: The ID of the file in the database

- `storageItem` () [✗]: Location of the image file

- `modelName` (string) [✗]: Optional: Specific model version to use



### ip-check-completed

**Description:** Contains IP verification results including trademark risk, copyright risk, detected brands/franchises, and analysis confidence scores

**Method:** `client.ip_check_completed(data, opts=None)`

**Payload Type:** `IpCheckCompletedMessage`

**Fields:**

- `modelId` (string) [✗]: Model UUID that was analyzed

- `ownerId` (string) [✗]: Owner user ID

- `entityType` (string) [✗]: Type of entity checked: 'model' or 'metamodel'

- `status` (string) [✗]: Overall IP check outcome: 'clear', 'flagged', or 'error'

- `trademarkRisk` (string) [✗]: Detected trademark infringement risk level: 'none', 'low', 'medium', 'high'

- `copyrightRisk` (string) [✗]: Detected copyright infringement risk level: 'none', 'low', 'medium', 'high'

- `matchedBrands` (array) [✗]: Brand names detected in model name or content

- `matchedFranchises` (array) [✗]: Franchise/character names detected

- `similarModelsCount` (integer) [✗]: Number of visually similar models found

- `confidence` (number) [✗]: Overall confidence score for the analysis (0.0-1.0)

- `riskScorePercent` (integer) [✗]: Risk score as 0-100 integer (FR-024: >70 HIGH, 40-70 MEDIUM, <40 LOW)

- `riskLevel` (string) [✗]: Overall risk level: 'none', 'low', 'medium', 'high'

- `recommendation` (string) [✗]: Recommended action: 'block' (HIGH risk), 'warn' (MEDIUM risk), 'allow' (LOW/NONE risk)

- `suggestedChanges` (object) [✗]: Suggested modifications to reduce IP risk

- `heuristicResults` (object) [✗]: Detailed results from each heuristic check

- `error` (object) [✗]: Error details if status is 'error'

- `processingDurationMs` (integer) [✗]: Total processing time in milliseconds



### ip-check-request

**Description:** Triggers intellectual property verification analysis for a model thumbnail, detecting potential trademark and copyright issues using perceptual hashing, text analysis, and optional reverse image search.

**Method:** `client.ip_check_request(data, opts=None)`

**Payload Type:** `IpCheckRequestMessage`

**Fields:**

- `modelId` (string) [✗]: Unique identifier for the model to analyze

- `ownerId` (string) [✗]: User ID who owns the model

- `entityType` (string) [✗]: Type of entity being checked: 'model' or 'metamodel'

- `modelName` (string) [✗]: Name of the model for trademark/franchise text detection

- `tags` (array) [✗]: Model tags for IP reference detection

- `description` (string) [✗]: Model description for text-based IP analysis

- `thumbnailUrl` (string) [✗]: URL to fetch the thumbnail image for visual analysis

- `minioPath` (string) [✗]: Path to thumbnail in MinIO if stored internally

- `additionalImageUrls` (array) [✗]: Optional additional images for more comprehensive analysis (e.g., 360° views)

- `analysisOptions` (object) [✗]: Optional analysis configuration



### marketplace-connection-sync-completed

**Description:** Notification that marketplace connection sync has completed. Contains updated connection metadata, profile information, and sync statistics.


**Method:** `client.marketplace_connection_sync_completed(data, opts=None)`

**Payload Type:** `MarketplaceConnectionSyncCompletedMessage`

**Fields:**

- `requestId` (string) [✗]: Original request ID for correlation

- `connectionId` (string) [✗]: Marketplace connection that was synced

- `marketplaceId` (string) [✗]: Marketplace provider ID

- `userId` (string) [✗]: Connection owner user ID

- `status` (string) [✗]: Overall sync result status

- `syncType` (string) [✗]: Type of sync that was performed

- `connectionData` (object) [✗]: Updated connection information

- `categories` (array) [✗]: Available marketplace categories

- `statistics` (object) [✗]: Sync operation statistics

- `completedAt` (string) [✗]: When sync completed

- `error` (object) [✗]: Error details if sync failed



### marketplace-connection-sync-request

**Description:** Requests synchronization of marketplace connection data including: - Profile information and shop details - Account status and permissions - Available categories and shipping profiles - Rate limits and API quotas
This is typically triggered after initial connection or periodically to keep marketplace metadata up to date.


**Method:** `client.marketplace_connection_sync_request(data, opts=None)`

**Payload Type:** `MarketplaceConnectionSyncRequestMessage`

**Fields:**

- `connectionId` (string) [✗]: Internal marketplace connection ID

- `marketplaceId` (string) [✗]: Marketplace provider ID (etsy, ebay, etc.)

- `userId` (string) [✗]: User who owns this connection

- `syncType` (string) [✗]: Type of sync to perform

- `priority` (string) [✗]: Processing priority

- `requestId` (string) [✗]: Unique request identifier for tracking

- `webhookUrl` (string) [✗]: Webhook URL to call when sync completes

- `metadata` (object) [✗]: Additional context data



### marketplace-credential-rotation-completed

**Description:** Notification that marketplace credential rotation has completed. Contains the rotation results, new credential metadata, and any issues encountered.


**Method:** `client.marketplace_credential_rotation_completed(data, opts=None)`

**Payload Type:** `MarketplaceCredentialRotationCompletedMessage`

**Fields:**

- `requestId` (string) [✗]: Original rotation request ID

- `connectionId` (string) [✗]: Marketplace connection that was rotated

- `marketplaceId` (string) [✗]: Marketplace provider ID

- `userId` (string) [✗]: Connection owner user ID

- `status` (string) [✗]: Overall rotation operation status

- `rotationType` (string) [✗]: Type of rotation that was performed

- `reason` (string) [✗]: Original reason for rotation

- `newCredentials` (object) [✗]: Metadata about new credentials

- `oldCredentials` (object) [✗]: Status of previous credentials

- `operationDetails` (object) [✗]: Details of the rotation operation

- `connectionStatus` (object) [✗]: Connection status after credential rotation

- `nextRotation` (object) [✗]: Information about next scheduled rotation

- `error` (object) [✗]: Error details if rotation failed

- `notifications` (array) [✗]: Notifications sent as part of rotation



### marketplace-credential-rotation-request

**Description:** Requests rotation/refresh of marketplace connection credentials. This is used for: - OAuth token refresh when tokens are near expiry - API key rotation for enhanced security - Re-authentication after connection errors - Scheduled credential updates


**Method:** `client.marketplace_credential_rotation_request(data, opts=None)`

**Payload Type:** `MarketplaceCredentialRotationRequestMessage`

**Fields:**

- `connectionId` (string) [✗]: Marketplace connection ID requiring credential rotation

- `marketplaceId` (string) [✗]: Marketplace provider ID (etsy, ebay, etc.)

- `userId` (string) [✗]: User who owns the connection

- `rotationType` (string) [✗]: Type of credential rotation to perform

- `reason` (string) [✗]: Reason for credential rotation

- `urgency` (string) [✗]: How urgently the rotation is needed

- `currentCredentials` (object) [✗]: Current credential metadata (no actual secrets)

- `options` (object) [✗]: Rotation configuration options

- `requestId` (string) [✗]: Unique request identifier

- `webhookUrl` (string) [✗]: Webhook URL for completion notification

- `scheduledAt` (string) [✗]: When this rotation was scheduled (if scheduled)

- `metadata` (object) [✗]: Additional request context



### marketplace-intelligence-completed

**Description:** Response from marketplace intelligence scraping.
Contains aggregated similarity data from marketplace searches.

Consumed by worker-backend to update pipeline context before
sellability analysis runs.


**Method:** `client.marketplace_intelligence_completed(data, opts=None)`

**Payload Type:** `MarketplaceIntelligenceCompletedMessage`

**Fields:**

- `modelId` (string) [✓]: UUID of the model that was researched

- `ownerId` (string) [✓]: UUID of the model owner

- `status` (string) [✓]: Result status

- `marketData` (object) [✗]: Aggregated market intelligence across all scraped marketplaces

- `marketplaceBreakdown` (array) [✗]: Results per marketplace

- `similarityScore` (number) [✗]: How saturated the market is for this model type (0=unique, 100=very common)

- `error` (object) [✗]: Error information if status is FAILED

- `analyzedAt` (string) [✗]: When the analysis completed

- `analysisVersion` (string) [✗]: Version of the intelligence collector



### marketplace-intelligence-event

**Description:** Public marketplace intelligence data scraped from external marketplaces.

This event contains:
- Listing details (title, price, images)
- Engagement metrics (views, favorites, reviews)
- Shop information
- Market positioning data

Unlike marketplace-listing-sync-request (private user data), this focuses on:
- Broad market trends and pricing analysis
- Competitive intelligence and demand signals
- Product popularity and sentiment

Consumed by worker-analytic-collector for Elasticsearch indexing.
Used for market research, pricing optimization, and trend detection.


**Method:** `client.marketplace_intelligence_event(data, opts=None)`

**Payload Type:** `MarketplaceIntelligenceEventMessage`

**Fields:**

- `marketplace` (string) [✓]: Source marketplace

- `externalId` (string) [✓]: Marketplace-native listing ID

- `listing` (object) [✓]: Core listing information

- `metrics` (object) [✗]: Public engagement and sales metrics

- `metadata` (object) [✗]: Additional listing context and categorization

- `queryContext` (object) [✗]: Search context that found this listing

- `collectedAt` (string) [✓]: ISO 8601 timestamp when data was scraped

- `collectorVersion` (string) [✗]: Version of collector that scraped this data

- `scrapingMethod` (string) [✗]: Method used for scraping



### marketplace-intelligence-request

**Description:** Triggers automated marketplace scraping to find similar/competing listings
for a given model. This is a pipeline stage that runs after metadata generation
to inform sellability analysis with real market data.

The worker-analytic-collector (or marketplace-connectors worker) will:
1. Use model metadata (title, tags, category) to build search queries
2. Scrape connected marketplaces (Etsy, eBay, etc.) for similar listings
3. Emit marketplace-intelligence-event results for Elasticsearch indexing
4. Return aggregated similarity data to the pipeline context

Pipeline integration:
- Triggered after: metadata-generation (needs model title/tags/category)
- Results feed into: sellability-analysis (market positioning data)


**Method:** `client.marketplace_intelligence_request(data, opts=None)`

**Payload Type:** `MarketplaceIntelligenceRequestMessage`

**Fields:**

- `modelId` (string) [✓]: UUID of the model to research

- `ownerId` (string) [✓]: UUID of the model owner

- `searchContext` (object) [✗]: Model metadata used to build marketplace search queries

- `scrapingOptions` (object) [✗]: Configuration for the marketplace scraping

- `pipelineId` (string) [✗]: Pipeline execution ID for correlation

- `executionId` (string) [✗]: Pipeline execution UUID for correlation



### marketplace-listing-description-generation-completed

**Description:** Notifies backend that marketplace description generation completed. Contains generated description with metadata tracking (AI model, confidence, generation timestamp) and suggested price.

**Method:** `client.marketplace_listing_description_generation_completed(data, opts=None)`

**Payload Type:** `MarketplaceListingDescriptionGenerationCompletedMessage`

**Fields:**

- `modelId` (string) [✓]: UUID of the model that was processed

- `entityType` (string) [✓]: Type of entity processed

- `targetMarketplace` (string) [✗]: Target marketplace ID (e.g., 'etsy', 'ebay')

- `description` (string) [✓]: SEO-optimized marketplace description (3-5 sentences)

- `metadata` (object) [✓]: Content generation metadata for tracking

- `suggestedPrice` (object) [✗]: Volume-based price calculation for 3D printed item

- `error` (string) [✗]: Error message if generation failed



### marketplace-listing-description-generation-request

**Description:** Generates SEO-optimized marketplace description for a 3D model using LLM vision analysis. Worker receives model data, technical metadata, and thumbnail URLs to generate compelling product descriptions tailored to the target marketplace.

**Method:** `client.marketplace_listing_description_generation_request(data, opts=None)`

**Payload Type:** `MarketplaceListingDescriptionGenerationRequestMessage`

**Fields:**

- `modelId` (string) [✓]: UUID of the model (reference only)

- `entityType` (string) [✓]: Type of entity being processed

- `entityName` (string) [✓]: Name/title of the model or metamodel

- `targetMarketplace` (string) [✓]: Target marketplace ID (e.g., 'etsy', 'ebay', 'thingiverse')

- `userId` (string) [✓]: UUID of the user requesting generation

- `webhookUrl` (string) [✗]: Callback URL for completion notification

- `technicalMetadata` (object) [✗]: Technical analysis data for context

- `thumbnailUrls` (array) [✗]: URLs to 360-degree thumbnail views

- `existingTags` (array) [✗]: Currently assigned tags for context

- `existingCategory` (string) [✗]: Current classification for context

- `brandVoice` (string) [✗]: Desired tone/voice for the listing (e.g., 'professional', 'playful')

- `targetMarket` (string) [✗]: Target geographic market (e.g., 'US', 'EU')

- `keywords` (array) [✗]: Specific keywords to include



### marketplace-listing-sync-completed

**Description:** Notification that marketplace listing sync operation has completed. Contains detailed results of the sync including created/updated listings, errors encountered, and performance statistics.


**Method:** `client.marketplace_listing_sync_completed(data, opts=None)`

**Payload Type:** `MarketplaceListingSyncCompletedMessage`

**Fields:**

- `requestId` (string) [✗]: Original request ID for correlation

- `connectionId` (string) [✗]: Marketplace connection that was synced

- `marketplaceId` (string) [✗]: Marketplace provider ID

- `userId` (string) [✗]: Connection owner user ID

- `status` (string) [✗]: Overall sync operation status

- `syncDirection` (string) [✗]: Direction of sync that was performed

- `statistics` (object) [✗]: Detailed sync operation statistics

- `results` (object) [✗]: Detailed sync results by operation

- `successfulListings` (array) [✗]: Details of successfully processed listings

- `failedListings` (array) [✗]: Details of listings that failed to sync

- `errors` (array) [✗]: Non-listing-specific errors encountered

- `completedAt` (string) [✗]: When sync operation completed

- `nextSyncRecommendedAt` (string) [✗]: When next sync is recommended



### marketplace-listing-sync-request

**Description:** Requests synchronization of marketplace listings for a connection. Can sync specific listings or all listings for a marketplace connection.
Includes bidirectional sync: - Pull: Fetch listings from marketplace to update local database - Push: Update marketplace listings with local changes - Full: Both pull and push operations


**Method:** `client.marketplace_listing_sync_request(data, opts=None)`

**Payload Type:** `MarketplaceListingSyncRequestMessage`

**Fields:**

- `connectionId` (string) [✗]: Marketplace connection ID

- `marketplaceId` (string) [✗]: Marketplace provider ID (etsy, ebay, etc.)

- `userId` (string) [✗]: User who owns the connection

- `syncDirection` (string) [✗]: Direction of sync operation

- `syncScope` (string) [✗]: Scope of listings to sync

- `listingIds` (array) [✗]: Specific listing IDs to sync (if syncScope=specific)

- `externalListingIds` (array) [✗]: External marketplace listing IDs to sync

- `options` (object) [✗]: Sync configuration options

- `priority` (string) [✗]: Processing priority

- `requestId` (string) [✗]: Unique request identifier

- `webhookUrl` (string) [✗]: Webhook URL for completion notification

- `metadata` (object) [✗]: Additional request context



### marketplace-listing-tags-generation-completed

**Description:** Notifies backend that marketplace tags generation completed. Contains generated tags optimized for discoverability with metadata tracking.

**Method:** `client.marketplace_listing_tags_generation_completed(data, opts=None)`

**Payload Type:** `MarketplaceListingTagsGenerationCompletedMessage`

**Fields:**

- `modelId` (string) [✓]: UUID of the model that was processed

- `entityType` (string) [✓]: Type of entity processed

- `tags` (array) [✓]: Generated searchability tags (style, technical, usage keywords)

- `metadata` (object) [✓]: Content generation metadata for tracking

- `error` (string) [✗]: Error message if generation failed



### marketplace-listing-tags-generation-request

**Description:** Generates searchability tags for a 3D model optimized for marketplace discoverability. Worker creates style, technical, and usage keywords following marketplace tag limits and SEO best practices.

**Method:** `client.marketplace_listing_tags_generation_request(data, opts=None)`

**Payload Type:** `MarketplaceListingTagsGenerationRequestMessage`

**Fields:**

- `modelId` (string) [✓]: UUID of the model (reference only)

- `entityType` (string) [✓]: Type of entity being processed

- `entityName` (string) [✓]: Name/title of the model or metamodel

- `targetMarketplace` (string) [✓]: Target marketplace ID (e.g., 'etsy', 'ebay', 'thingiverse')

- `userId` (string) [✓]: UUID of the user requesting generation

- `webhookUrl` (string) [✗]: Callback URL for completion notification

- `technicalMetadata` (object) [✗]: Technical analysis data for tag generation

- `thumbnailUrls` (array) [✗]: URLs to 360-degree thumbnail views for visual analysis

- `existingTags` (array) [✗]: Currently assigned tags to supplement or replace

- `existingCategory` (string) [✗]: Current classification for category-based tags

- `tagLimit` (number) [✗]: Maximum number of tags for marketplace (e.g., 13 for Etsy)

- `targetMarket` (string) [✗]: Target geographic market (e.g., 'US', 'EU')

- `style` (string) [✗]: Artistic style of the model (e.g., 'realistic', 'low-poly')

- `useCases` (array) [✗]: Intended uses for the model



### marketplace-listing-title-generation-completed

**Description:** Notifies backend that marketplace title generation completed. Contains generated title with metadata tracking.

**Method:** `client.marketplace_listing_title_generation_completed(data, opts=None)`

**Payload Type:** `MarketplaceListingTitleGenerationCompletedMessage`

**Fields:**

- `modelId` (string) [✓]: UUID of the model that was processed

- `entityType` (string) [✓]: Type of entity processed

- `title` (string) [✓]: Marketplace-optimized title

- `metadata` (object) [✓]: Content generation metadata for tracking

- `error` (string) [✗]: Error message if generation failed



### marketplace-listing-title-generation-request

**Description:** Generates marketplace-optimized title for a 3D model. Worker creates concise, SEO-friendly titles following marketplace character limits and best practices.

**Method:** `client.marketplace_listing_title_generation_request(data, opts=None)`

**Payload Type:** `MarketplaceListingTitleGenerationRequestMessage`

**Fields:**

- `modelId` (string) [✓]: UUID of the model (reference only)

- `entityType` (string) [✓]: Type of entity being processed

- `currentName` (string) [✓]: Current model/metamodel name

- `targetMarketplace` (string) [✓]: Target marketplace ID (e.g., 'etsy', 'ebay', 'thingiverse')

- `userId` (string) [✓]: UUID of the user requesting generation

- `webhookUrl` (string) [✗]: Callback URL for completion notification

- `technicalMetadata` (object) [✗]: Technical analysis data for context

- `existingTags` (array) [✗]: Currently assigned tags for SEO keywords

- `existingCategory` (string) [✗]: Current classification for categorization

- `characterLimit` (number) [✗]: Maximum character count for marketplace (e.g., 140 for Etsy)

- `brandVoice` (string) [✗]: Desired tone/voice for the listing (e.g., 'professional', 'playful')

- `targetMarket` (string) [✗]: Target geographic market (e.g., 'US', 'EU')

- `keywords` (array) [✗]: Specific keywords to include



### marketplace-listing-update-completed

**Description:** Result of a listing update operation

**Method:** `client.marketplace_listing_update_completed(data, opts=None)`

**Payload Type:** `MarketplaceListingUpdateCompletedMessage`

**Fields:**

- `marketplace` (string) [✗]: Target marketplace

- `listingId` (string) [✗]: External ID of the listing

- `status` (string) [✗]: Status of the update (success, failed)

- `result` (object) [✗]: Result details from the marketplace API

- `error` (string) [✗]: Error message if failed



### marketplace-listing-update-request

**Description:** Request to update an existing listing on a marketplace (price, quantity, etc.)

**Method:** `client.marketplace_listing_update_request(data, opts=None)`

**Payload Type:** `MarketplaceListingUpdateRequestMessage`

**Fields:**

- `marketplace` (string) [✗]: Target marketplace (etsy, ebay, etc.)

- `listingId` (string) [✗]: External ID of the listing to update

- `updates` (object) [✗]: Fields to update

- `credentials` (object) [✗]: User credentials for the marketplace



### media-batch-download-completed

**Description:** Notifies that a batch media download has been completed.

**Method:** `client.media_batch_download_completed(data, opts=None)`

**Payload Type:** `MediaBatchDownloadCompletedMessage`

**Fields:**

- `batchId` (string) [✓]: The unique identifier for the batch download operation.

- `status` (string) [✓]: The final status of the batch download operation.

- `processedFiles` (array) [✗]: List of successfully processed files.

- `failedFiles` (array) [✗]: List of files that failed to process.

- `processedAt` (string) [✓]: Timestamp when the batch processing completed.

- `statistics` (object) [✗]: Statistics about the batch processing.



### media-batch-download-request

**Description:** Request to download and process a batch of media files from a storage provider. Images are compressed and resized to specified dimensions, converted to WebP format. Text files and documents are processed and stored with metadata. All processed files are uploaded to MinIO S3 storage under the media/{batchId}/ prefix.


**Method:** `client.media_batch_download_request(data, opts=None)`

**Payload Type:** `MediaBatchDownloadRequestMessage`

**Fields:**

- `batchId` (string) [✗]: Unique identifier for this batch of media files. Used for organizing processed files in S3 storage (media/{batchId}/) and correlating with completion responses.


- `downloadStrategy` (string) [✗]: Download strategy for media files: - storage_provider: Download from authenticated storage connection (Google Drive, SFTP, etc.) - external_url: Download from public HTTP URLs (CDN, API responses, Thingiverse, etc.)


- `entityType` (string) [✗]: Type of entity these media files belong to. Used for linking downloaded media to the correct entity in the database.


- `entityId` (string) [✗]: UUID of the model or metamodel entity that owns these media files. Used for creating storage item associations after download.


- `storageConnectionId` (string) [✗]: UUID of the StorageConnection entity from which to download the media files. Required when downloadStrategy is 'storage_provider'. Used to authenticate and access the source storage provider.


- `credentials` (object) [✗]: Decrypted credentials for the storage provider (Fat Payload pattern). Required when downloadStrategy is 'storage_provider'.


- `mediaFiles` (array) [✗]: Array of media files to download and process. Must contain at least one file. Each file includes metadata for identification and processing.


- `compressionSettings` (object) [✗]: Optional compression settings that override deployment environment defaults. If not provided, uses values from MAX_IMAGE_WIDTH, MAX_IMAGE_HEIGHT, IMAGE_QUALITY, and OUTPUT_FORMAT environment variables.




### metamodel-metadata-generation-completed

**Description:** Handles metamodel metadata generation completion. Contains AI-generated metadata and aggregated technical analysis.

**Method:** `client.metamodel_metadata_generation_completed(data, opts=None)`

**Payload Type:** `MetamodelMetadataGenerationCompletedMessage`

**Fields:**

- `metamodelId` (string) [✓]: The unique identifier for the metamodel

- `metadata` (object) [✓]: AI-generated metadata for the metamodel

- `technicalMetadata` (object) [✓]: Aggregated technical analysis from constituent models



### metamodel-metadata-generation-request

**Description:** Handles metamodel metadata generation requests via Ollama. Aggregates data from constituent models and generates AI-enhanced metadata.

**Method:** `client.metamodel_metadata_generation_request(data, opts=None)`

**Payload Type:** `MetamodelMetadataGenerationRequestMessage`

**Fields:**

- `metamodelId` (string) [✗]: The unique identifier for the metamodel

- `constituentModelIds` (array) [✗]: Array of model IDs that compose this metamodel

- `name` (string) [✗]: The name of the metamodel

- `ownerId` (string) [✗]: The owner's user ID

- `libraryId` (string) [✗]: The library containing this metamodel

- `constituentModels` (array) [✗]: Enriched metadata for constituent models (includes storage items)

- `webhookUrl` (string) [✗]: Optional webhook URL for async completion notification



### model-analytics-collection-request

**Description:** Request to collect marketplace analytics for a specific metamodel.
Triggered by backend scheduler every 6 hours for popular/tagged metamodels.

Worker performs targeted market searches based on metamodel metadata
and stores aggregated statistics in Elasticsearch for trend analysis.


**Method:** `client.model_analytics_collection_request(data, opts=None)`

**Payload Type:** `ModelAnalyticsCollectionRequestMessage`

**Fields:**

- `metamodelId` (string) [✓]: The metamodel ID to collect analytics for

- `ownerId` (string) [✓]: Owner user ID for audit trail

- `primaryCategory` (string) [✗]: Primary classification category (e.g., "miniature", "terrain")

- `subCategory` (string) [✗]: Sub-category for more specific targeting

- `tags` (array) [✗]: Relevant tags from metamodel metadata (max 10)

- `franchise` (string) [✗]: Franchise name if detected (e.g., "Dungeons & Dragons")

- `confidence` (number) [✗]: Classification confidence score

- `priority` (string) [✗]: Collection priority level

- `triggeredBy` (string) [✗]: Source of trigger (e.g., "backend-scheduler", "manual")

- `triggeredAt` (string) [✗]: Timestamp when collection was triggered



### model-discovery-folder-processed-event

**Description:** Handles model discovery folder processed events.

**Method:** `client.model_discovery_folder_processed_event(data, opts=None)`

**Payload Type:** `ModelDiscoveryFolderProcessedEventMessage`

**Fields:**

- `connectionId` (string) [✗]: The unique identifier for the connection.

- `folderPath` (string) [✗]: The path to the processed folder.

- `discoveredFiles` (array) [✗]: A list of files discovered in the folder.

- `folderSignature` (object) [✗]: A signature representing the state of the folder.

- `processedAt` (string) [✗]: The timestamp when the folder was processed.

- `statistics` (object) [✗]: Statistics about the processed folder.



### model-discovery-scan-found-event

**Description:** Handles model discovery scan found events.

**Method:** `client.model_discovery_scan_found_event(data, opts=None)`

**Payload Type:** `ModelDiscoveryScanFoundEventMessage`

**Fields:**

- `modelId` (string) [✗]: The unique identifier for the model.

- `name` (string) [✗]: The name of the model.

- `fileName` (string) [✗]: The name of the model file.

- `description` (string) [✗]: A description of the model.

- `fileTypes` (array) [✗]: An array of file types associated with the model.

- `size` (number) [✗]: The size of the model file in bytes.

- `storageLocation` (object) [✗]: The storage location of the model.

- `providerType` (string) [✗]: The type of the storage provider.

- `metadata` (object) [✗]: A flexible object for additional metadata.



### model-discovery-scan-progress-event

**Description:** Handles model discovery scan progress events.

**Method:** `client.model_discovery_scan_progress_event(data, opts=None)`

**Payload Type:** `ModelDiscoveryScanProgressEventMessage`

**Fields:**

- `payload` (object) [✗]: Contains the discovery scan progress details.



### model-discovery-scan-request

**Description:** Handles model discovery scan requests events.

**Method:** `client.model_discovery_scan_request(data, opts=None)`

**Payload Type:** `ModelDiscoveryScanRequestMessage`

**Fields:**

- `libraryId` (string) [✗]: The ID of the library to scan.

- `storageConnectionId` (string) [✗]: The ID of the storage connection to scan.

- `providerType` (string) [✗]: The type of the storage provider.

- `path` (string) [✗]: The specific path within the storage connection to scan for this library.

- `credentials` (object) [✗]: Decrypted credentials for the storage provider.

- `configuration` (object) [✗]: Configuration for the storage connection (e.g. scanRootPath).



### model-finder-index-request

**Description:** DEPRECATED (2026-02-18) — FR-023 retired. Merge 3D rendering into worker-file-vectorize.

**Method:** `client.model_finder_index_request(data, opts=None)`

**Payload Type:** `ModelFinderIndexRequestMessage`

**Fields:**

- `modelId` (string) [✗]: 

- `storageItem` () [✗]: 



### model-finder-response

**Description:** DEPRECATED (2026-02-18) — FR-023 retired. Merge 3D rendering into worker-file-vectorize.

**Method:** `client.model_finder_response(data, opts=None)`

**Payload Type:** `ModelFinderResponseMessage`

**Fields:**

- `requestId` (string) [✗]: 

- `results` (array) [✗]: 



### model-finder-search-request

**Description:** DEPRECATED (2026-02-18) — FR-023 retired. Merge 3D rendering into worker-file-vectorize.

**Method:** `client.model_finder_search_request(data, opts=None)`

**Payload Type:** `ModelFinderSearchRequestMessage`

**Fields:**

- `referenceModelId` (string) [✗]: Optional: Search using an existing model as reference

- `referenceImageId` (string) [✗]: Optional: Search using an uploaded image

- `limit` (integer) [✗]: 



### model-metadata-generation-completed

**Description:** Notifies backend that enriched marketplace metadata generation completed. Backend updates Model entity with generated description, tags, classification, etc.

**Method:** `client.model_metadata_generation_completed(data, opts=None)`

**Payload Type:** `ModelMetadataGenerationCompletedMessage`

**Fields:**

- `modelId` (string) [✓]: UUID of the model that was processed.

- `metadata` (object) [✓]: Enriched marketplace metadata generated by LLM.



### model-metadata-generation-request

**Description:** Generates enriched marketplace metadata (SEO descriptions, tags, categories) for 3D models using LLM vision analysis. Worker receives all necessary data in the payload (Model, TechnicalMetadata, Thumbnails) and does NOT query the database. Prerequisites: file download, technical metadata, and thumbnail generation must be complete before this message is sent.

**Method:** `client.model_metadata_generation_request(data, opts=None)`

**Payload Type:** `ModelMetadataGenerationRequestMessage`

**Fields:**

- `modelId` (string) [✗]: UUID of the model (reference only)

- `model` (object) [✗]: Core model entity data

- `technicalMetadata` (object) [✗]: Geometric and technical analysis results

- `thumbnails` (array) [✗]: List of 360 degree thumbnail views (URLs or paths)



### model-metamodel-detection-found

**Description:** Handles model metamodel detection found with hierarchical relationships.

**Method:** `client.model_metamodel_detection_found(data, opts=None)`

**Payload Type:** `ModelMetamodelDetectionFoundMessage`

**Fields:**

- `metamodels` (array) [✓]: List of metamodel nodes in hierarchical structure (roots and children).

- `ekgEdges` (array) [✗]: EKG edges derived from Louvain clustering (OPTIONAL - new field)



### model-metamodel-detection-request

**Description:** Handles model metamodel detection requests.

**Method:** `client.model_metamodel_detection_request(data, opts=None)`

**Payload Type:** `ModelMetamodelDetectionRequestMessage`

**Fields:**

- `connectionId` (string) [✓]: The unique identifier for the storage connection.

- `folderPath` (string) [✓]: The path to the folder that was processed.

- `discoveredFiles` (array) [✗]: A list of files discovered in the folder. Worker should check this first, then manifestUrl.

- `manifestUrl` (string) [✗]: URL to a JSON file containing the list of discovered files (for large folders)

- `folderSignature` (object) [✓]: A signature representing the state of the folder.

- `processedAt` (string) [✓]: The timestamp when the folder was processed.

- `statistics` (object) [✓]: Statistics about the processed folder.



### model-print-analysis-completed

**Description:** Reports completion of 3D print analysis — contains estimation, printability, and cost breakdown per FR-022

**Method:** `client.model_print_analysis_completed(data, opts=None)`

**Payload Type:** `ModelPrintAnalysisCompletedMessage`

**Fields:**

- `originalJobId` (string) [✗]: ID of the original analysis request job

- `modelId` (string) [✗]: UUID of the analysed model

- `status` (string) [✗]: Analysis result status

- `errorMessage` (string) [✗]: Error description when status is FAILED

- `material` (string) [✗]: Material type used for estimation

- `quality` (string) [✗]: Quality preset used

- `printTimeMinutes` (number) [✗]: Estimated total print time in minutes

- `materialGrams` (number) [✗]: Estimated material consumption in grams (body only)

- `needsSupport` (boolean) [✗]: Whether the model requires support structures

- `supportMaterialGrams` (number) [✗]: Estimated support material in grams

- `overhangPercentage` (number) [✗]: Percentage of surface area with overhangs > 45°

- `minWallThicknessMm` (number) [✗]: Thinnest detected wall in millimeters

- `solidVolumeCm3` (number) [✗]: Solid volume of the mesh in cm³

- `surfaceAreaCm2` (number) [✗]: Total surface area in cm²

- `boundingBox` (object) [✗]: Bounding box in millimeters

- `estimatedCostEUR` (number) [✗]: Total estimated production cost in EUR

- `costBreakdown` (object) [✗]: Granular cost breakdown per WF-009 MaterialCostCalculatorService



### model-print-analysis-request

**Description:** Triggers 3D print analysis for a model — estimates print time, material usage, support needs, and cost breakdown per FR-022

**Method:** `client.model_print_analysis_request(data, opts=None)`

**Payload Type:** `ModelPrintAnalysisRequestMessage`

**Fields:**

- `modelId` (string) [✗]: UUID of the model to analyse

- `ownerId` (string) [✗]: UUID of the user who owns the model

- `material` (string) [✗]: Material type enum value (e.g. PLA, PETG, RESIN_STANDARD)

- `quality` (string) [✗]: Print quality preset

- `webhookUrl` (string) [✗]: URL called when analysis completes or fails

- `minioPath` (string) [✗]: Path to model in MinIO storage for geometry analysis (e.g. 'raw_models/{modelId}/original.glb')



### model-sellability-analysis-completed

**Description:** Contains sellability analysis results including Etsy-specific recommendations, material pricing, and marketplace compatibility scores

**Method:** `client.model_sellability_analysis_completed(data, opts=None)`

**Payload Type:** `ModelSellabilityAnalysisCompletedMessage`

**Fields:**

- `metamodelId` (string) [✗]: Metamodel UUID

- `ownerId` (string) [✗]: Owner user ID

- `sellabilityScore` (number) [✗]: Overall sellability score (0-100)

- `pricingRecommendations` (object) [✗]: Pricing analysis and recommendations with material-specific pricing (v2.0.0)

- `marketplaceRecommendations` (array) [✗]: Recommended marketplaces with Etsy-specific scoring (v2.0.0)

- `demandAnalysis` (object) [✗]: Market demand insights

- `qualityFactors` (object) [✗]: Quality-related factors affecting sellability

- `recommendations` (array) [✗]: Actionable recommendations to improve sellability

- `analyzedAt` (string) [✗]: Analysis completion timestamp (ISO 8601)

- `analysisVersion` (string) [✗]: Analysis algorithm version

- `error` (object) [✗]: Error information if analysis failed



### model-sellability-analysis-request

**Description:** Analyzes a metamodel to determine sellability score, pricing recommendations, and optimal marketplace selection. Enhanced with Etsy-specific analysis including competitor pricing, category demand trends, and material suitability.

**Method:** `client.model_sellability_analysis_request(data, opts=None)`

**Payload Type:** `ModelSellabilityAnalysisRequestMessage`

**Fields:**

- `metamodelId` (string) [✗]: UUID of the metamodel to analyze.

- `ownerId` (string) [✗]: UUID of the user who owns the metamodel

- `metamodelData` (object) [✗]: Full metamodel data including technical metadata, enriched metadata, and child models. Injected by backend to avoid DB access.

- `manifestUrl` (string) [✗]: URL to a JSON manifest containing the metamodel data if it is too large for the message payload.

- `analysisOptions` (object) [✗]: Optional analysis configuration



### model-semantic-analysis-completed

**Description:** Handles completion of 3D model semantic analysis with generated tags and similarity results.

**Method:** `client.model_semantic_analysis_completed(data, opts=None)`

**Payload Type:** `ModelSemanticAnalysisCompletedMessage`

**Fields:**

- `modelId` (string) [✗]: The unique identifier for the model.

- `userId` (string) [✗]: The user ID who owns the model.

- `processingStatus` (string) [✗]: Final processing status.

- `semanticMetadata` (object) [✗]: Generated semantic metadata and analysis results.

- `processingTime` (object) [✗]: Processing performance metrics.

- `qualityMetrics` (object) [✗]: Processing quality and confidence metrics.

- `error` (object) [✗]: Error information if processing failed.

- `debugInfo` (object) [✗]: Additional debug information for troubleshooting.



### model-semantic-analysis-request

**Description:** Handles 3D model semantic analysis requests using ULIP-2 neural networks and FAISS vector similarity search.

**Method:** `client.model_semantic_analysis_request(data, opts=None)`

**Payload Type:** `ModelSemanticAnalysisRequestMessage`

**Fields:**

- `modelId` (string) [✗]: The unique identifier for the model.

- `userId` (string) [✗]: The user ID who owns the model.

- `storageConnectionId` (string) [✗]: The ID of the storage connection.

- `filePath` (string) [✗]: The path to the 3D model file in storage.

- `fileName` (string) [✗]: The name of the model file.

- `fileSize` (number) [✗]: The size of the model file in bytes.

- `storageProviderType` (string) [✗]: The type of the storage provider (S3, GoogleDrive, SFTP, etc).

- `processingOptions` (object) [✗]: Configuration options for semantic analysis.

- `priority` (number) [✗]: Processing priority (1=highest, 10=lowest).

- `webhookUrl` (string) [✗]: Optional webhook URL for completion notification.

- `retryCount` (number) [✗]: Current retry attempt number.



### model-technical-metadata-completed

**Description:** Reports comprehensive results of technical metadata analysis including geometry, quality metrics, and print-readiness assessment

**Method:** `client.model_technical_metadata_completed(data, opts=None)`

**Payload Type:** `ModelTechnicalMetadataCompletedMessage`

**Fields:**

- `originalJobId` (string) [✗]: ID of the original analysis request job

- `modelId` (string) [✗]: ID of the analyzed model

- `status` (string) [✗]: Analysis completion status

- `vertices` (integer) [✗]: Number of vertices in the mesh

- `faces` (integer) [✗]: Number of faces/polygons in the mesh

- `edges` (integer) [✗]: Number of edges in the mesh

- `detailLevel` (string) [✗]: Visual detail level based on polygon density

- `boundingBox` (object) [✗]: 3D bounding box dimensions in millimeters

- `volumeCubicMm` (number) [✗]: Model volume in cubic millimeters (for material calculation)

- `surfaceAreaSqMm` (number) [✗]: Total surface area in square millimeters

- `minWallThickness` (number) [✗]: Minimum wall thickness detected in millimeters (critical for printability)

- `maxWallThickness` (number) [✗]: Maximum wall thickness detected in millimeters

- `manifold` (boolean) [✗]: Is the mesh watertight/manifold? Critical for 3D printing (true = printable)

- `nonManifoldEdges` (integer) [✗]: Number of non-manifold edges (repair needed if > 0)

- `holes` (integer) [✗]: Number of holes/boundary loops in the mesh (0 = closed mesh)

- `flippedNormals` (integer) [✗]: Number of faces with inverted normals (causes rendering/slicing issues)

- `selfIntersections` (integer) [✗]: Number of self-intersecting faces (0 = clean geometry)

- `qualityScore` (number) [✗]: Overall quality score 0-100 (100 = perfect for printing, <60 needs repair)

- `printabilityScore` (number) [✗]: Printability score 0-100 (considers supports, orientation, size constraints)

- `requiresSupports` (boolean) [✗]: Does this model require support structures for 3D printing?

- `overhangs` (array) [✗]: Detected overhang areas requiring support structures

- `estimatedPrintTimeMinutes` (integer) [✗]: Estimated print time in minutes using normal quality settings (0.2mm layers, 20% infill)

- `printTimeEstimates` (object) [✗]: Print time estimates for different quality presets

- `estimatedMaterialGrams` (number) [✗]: Estimated material usage in grams using 20% infill (assumes PLA density 1.24g/cm³)

- `materialEstimates` (object) [✗]: Material usage estimates for different infill percentages

- `recommendedOrientation` (object) [✗]: Recommended print orientation for minimal support material and best results

- `slicerRecommendations` (object) [✗]: Slicer-derived recommended print settings based on model analysis (feeds into print job creation as defaults)

- `originalUnit` (string) [✗]: Original file format unit detected from metadata or inferred from scale

- `formatVersion` (string) [✗]: File format version (e.g., 'STL Binary', 'OBJ v4', 'PLY 1.0')

- `hasColorData` (boolean) [✗]: Does the file contain per-vertex color information?

- `hasTextureCoordinates` (boolean) [✗]: Does the file contain UV texture mapping coordinates?

- `hasVertexNormals` (boolean) [✗]: Does the file contain per-vertex normal vectors?

- `analyzedBy` (string) [✗]: Tool/service that performed the analysis

- `analysisVersion` (string) [✗]: Version of the analysis algorithm (for tracking improvements)

- `analysisConfidence` (number) [✗]: Confidence level of analysis results (0.0 = uncertain, 1.0 = highly confident)

- `analysisWarnings` (array) [✗]: Warnings or issues detected during analysis (structured for programmatic handling)

- `analyzedAt` (string) [✗]: ISO 8601 timestamp when analysis was performed (e.g., '2025-11-19T14:35:22Z')

- `errorMessage` (string) [✗]: Detailed error message if status is FAILED

- `errorCode` (string) [✗]: Machine-readable error code for programmatic error handling



### model-technical-metadata-request

**Description:** Triggers comprehensive technical analysis of a 3D model file to extract geometry, quality metrics, and print-readiness information

**Method:** `client.model_technical_metadata_request(data, opts=None)`

**Payload Type:** `ModelTechnicalMetadataRequestMessage`

**Fields:**

- `modelId` (string) [✗]: Unique identifier for the model to analyze

- `ownerId` (string) [✗]: User ID who owns the model

- `storageLocation` (object) [✗]: Location of the 3D model file (legacy - used for direct download if minioPath not provided)

- `minioPath` (string) [✗]: Path to model in MinIO (e.g., 'raw_models/{modelId}/original.glb'). If provided, file will be read from MinIO instead of downloading from storage provider.

- `parentJobId` (string) [✗]: ID of parent file-download job (for BullMQ dependency tracking).

- `analysisOptions` (object) [✗]: Optional analysis configuration parameters



### slicing-fdm-request

**Description:** Request FDM slicing simulation via OrcaSlicer (preferred) or heuristic fallback. Accepts OrcaSlicer-compatible printer/process/filament JSON profiles.

**Method:** `client.slicing_fdm_request(data, opts=None)`

**Payload Type:** `SlicingFdmRequestMessage`

**Fields:**

- `modelId` (string) [✗]: UUID of the model

- `storageItemId` (string) [✗]: UUID or path of the storage item to download the STL/3MF

- `profileId` (string) [✗]: UUID of the user's slicer profile from the database

- `profileName` (string) [✗]: Human-readable profile name (e.g. 'My Bambu X1C - PLA Fine')

- `printerProfile` (object) [✗]: OrcaSlicer printer profile JSON: nozzle_diameter, bed_shape, max speeds, acceleration, retraction

- `processProfile` (object) [✗]: OrcaSlicer process profile JSON: layer_height, sparse_infill_density, wall_loops, speeds, support settings

- `filamentProfile` (object) [✗]: OrcaSlicer filament profile JSON: filament_type, filament_density, temperature, flow_ratio, retraction

- `layerHeight` (number) [✗]: Override: layer height in mm (takes precedence over processProfile)

- `infillPercentage` (number) [✗]: Override: infill percentage (0-100)

- `nozzleDiameter` (number) [✗]: Override: nozzle diameter in mm

- `printSpeed` (number) [✗]: Override: outer wall print speed in mm/s

- `wallCount` (integer) [✗]: Override: number of wall loops / perimeters

- `supportEnabled` (boolean) [✗]: Override: generate support structures

- `materialDensity` (number) [✗]: Override: filament density in g/cm³ (default: 1.24 PLA)

- `webhookUrl` (string) [✗]: URL to POST the slicing result back to



### slicing-fdm-result

**Description:** Result of FDM slicing simulation from OrcaSlicer (toolpath) or heuristic fallback. Contains exact physical metrics for cost calculation.

**Method:** `client.slicing_fdm_result(data, opts=None)`

**Payload Type:** `SlicingFdmResultMessage`

**Fields:**

- `modelId` (string) [✗]: UUID of the model

- `status` (string) [✗]: Status of the simulation

- `printTimeHours` (number) [✗]: Exact print time in hours (from toolpath analysis)

- `materialWeightGrams` (number) [✗]: Total filament weight in grams (including supports)

- `materialVolumeCm3` (number) [✗]: Extruded material volume in cm³

- `maxZHeightMM` (number) [✗]: Maximum Z height in mm

- `supportMaterialWeightGrams` (number) [✗]: Support structure filament weight in grams

- `layerCount` (integer) [✗]: Total number of layers

- `totalExtrusionLengthMm` (number) [✗]: Total filament extrusion length in mm

- `slicingMethod` (string) [✗]: Engine that produced the result

- `slicerVersion` (string) [✗]: Version of the slicer engine used

- `profileUsed` (string) [✗]: Name or ID of the slicer profile used

- `errorCode` (string) [✗]: Error code if simulation failed

- `errorMessage` (string) [✗]: Error message if simulation failed



### slicing-sla-request

**Description:** Request SLA/MSLA slicing simulation via PySLM cross-sectional analysis. Accepts resin printer profile with exposure, lift, and layer parameters.

**Method:** `client.slicing_sla_request(data, opts=None)`

**Payload Type:** `SlicingSlaRequestMessage`

**Fields:**

- `modelId` (string) [✗]: UUID of the model

- `storageItemId` (string) [✗]: UUID or path of the storage item to download the STL/3MF

- `technology` (string) [✗]: SLA or MSLA

- `profileId` (string) [✗]: UUID of the user's slicer profile from the database

- `profileName` (string) [✗]: Human-readable profile name (e.g. 'Elegoo Mars 3 - Standard Grey')

- `layerHeight` (number) [✗]: Layer height in mm (default: 0.05)

- `exposureTime` (number) [✗]: Normal layer UV exposure time in seconds (default: 2.5)

- `bottomExposureTime` (number) [✗]: Bottom/burn-in layer exposure time in seconds (default: 30)

- `bottomLayers` (integer) [✗]: Number of bottom/burn-in layers (default: 5)

- `liftHeight` (number) [✗]: Platform lift height in mm between layers (default: 5.0)

- `liftSpeed` (number) [✗]: Platform lift speed in mm/min (default: 60)

- `retractSpeed` (number) [✗]: Platform retract speed in mm/min (default: 150)

- `resinDensity` (number) [✗]: Resin density in g/cm³ (default: 1.1)

- `supportEnabled` (boolean) [✗]: Generate support structures (default: true for SLA)

- `webhookUrl` (string) [✗]: URL to POST the slicing result back to



### slicing-sla-result

**Description:** Result of SLA/MSLA slicing simulation from PySLM cross-sectional analysis. Contains exact resin usage and print time metrics.

**Method:** `client.slicing_sla_result(data, opts=None)`

**Payload Type:** `SlicingSlaResultMessage`

**Fields:**

- `modelId` (string) [✗]: UUID of the model

- `status` (string) [✗]: Status of the simulation

- `printTimeHours` (number) [✗]: Exact print time in hours (from cross-sectional analysis)

- `materialWeightGrams` (number) [✗]: Total resin weight in grams (including supports)

- `materialVolumeCm3` (number) [✗]: Cured resin volume in cm³ (from cross-sectional area integration)

- `maxZHeightMM` (number) [✗]: Maximum Z height in mm

- `supportMaterialWeightGrams` (number) [✗]: Support structure resin weight in grams

- `layerCount` (integer) [✗]: Total number of layers

- `maxCrossSectionAreaMm2` (number) [✗]: Maximum cross-sectional area in mm² (affects MSLA peel force)

- `slicingMethod` (string) [✗]: Engine that produced the result

- `slicerVersion` (string) [✗]: Version of PySLM / trimesh used

- `profileUsed` (string) [✗]: Name or ID of the slicer profile used

- `errorCode` (string) [✗]: Error code if simulation failed

- `errorMessage` (string) [✗]: Error message if simulation failed



### texture-generation-completed

**Description:** Emitted when AI texture generation completes (success or failure). Contains artifact S3 URLs on success, or error details on failure. The credit reservation should be confirmed (success) or released (failure) based on the status.

**Method:** `client.texture_generation_completed(data, opts=None)`

**Payload Type:** `TextureGenerationCompletedMessage`

**Fields:**

- `jobId` (string) [✗]: The unique job identifier matching the original request.

- `modelId` (string) [✗]: The ID of the model that was textured.

- `tenantId` (string) [✗]: The tenant who owns the model.

- `status` (string) [✗]: The result status of the texture generation.

- `artifacts` (object) [✗]: S3 URLs of generated texture artifacts. Present only when status is 'completed'.

- `error` (object) [✗]: Error details. Present only when status is 'failed'.

- `metrics` (object) [✗]: Pipeline performance metrics.

- `creditReservationId` (string) [✗]: Credit reservation ID to confirm (on success) or release (on failure).



### texture-generation-request

**Description:** Request AI-powered texture generation for a 3D model. Requires a mesh file URL and a text prompt describing the desired texture. Credits are reserved before dispatch.

**Method:** `client.texture_generation_request(data, opts=None)`

**Payload Type:** `TextureGenerationRequestMessage`

**Fields:**

- `jobId` (string) [✗]: Unique job identifier for tracking.

- `modelId` (string) [✗]: The unique identifier for the model to texture.

- `tenantId` (string) [✗]: The identifier of the tenant requesting the generation.

- `meshUrl` (string) [✗]: S3 URL to the source mesh file (GLB, OBJ, or STL).

- `prompt` (string) [✗]: Text description of the desired texture (1-500 characters). Example: 'weathered bronze with green patina'.

- `stylePreset` (string) [✗]: Style preset to guide the texture generation aesthetic.

- `resolution` (integer) [✗]: Output texture resolution (width = height in pixels).

- `creditReservationId` (string) [✗]: Credit reservation ID from the credit ledger. Must be confirmed on completion or released on failure.



### thumbnail-generation-completed

**Description:** Handles thumbnail generation completed.

**Method:** `client.thumbnail_generation_completed(data, opts=None)`

**Payload Type:** `ThumbnailGenerationCompletedMessage`

**Fields:**

- `originalJobId` (string) [✗]: The ID of the original job that requested the thumbnail generation.

- `modelId` (string) [✗]: The ID of the model that the thumbnail was generated for.

- `status` (string) [✗]: The status of the thumbnail generation.

- `thumbnailPath` (string) [✗]: The path to the generated thumbnail.

- `thumbnail360Views` (array) [✗]: Array of 360° thumbnail view paths (16 angles) for vision-based analysis.

- `gltfPreviewPath` (string) [✗]: The path to the generated GLTF/GLB 3D preview file.

- `animatedPreviewPath` (string) [✗]: The path to the generated animated MP4 preview file.

- `errorMessage` (string) [✗]: An error message if the thumbnail generation failed.

- `storageLocation` (object) [✗]: The storage location of the model.



### thumbnail-generation-request

**Description:** Handles thumbnail generation requests with customization options. Supports both storage provider downloads and MinIO-cached files.

**Method:** `client.thumbnail_generation_request(data, opts=None)`

**Payload Type:** `ThumbnailGenerationRequestMessage`

**Fields:**

- `modelId` (string) [✗]: The unique identifier for the model requiring a thumbnail.

- `ownerId` (string) [✗]: The identifier of the user who owns the entity.

- `storageLocation` (object) [✗]: The storage location of the model (legacy - used for direct download if minioPath not provided).

- `minioPath` (string) [✗]: Path to model in MinIO (e.g., 'raw_models/{modelId}/original.glb'). If provided, file will be read from MinIO instead of downloading from storage provider.

- `previewType` (string) [✗]: The type of preview to generate, e.g., 'default', 'static', 'glb'.

- `generate360Views` (boolean) [✗]: Generate 16 angle views for 360° preview (4 horizontal x 4 vertical angles) for enhanced vision-based metadata analysis.

- `parentJobId` (string) [✗]: ID of parent file-download job (for BullMQ dependency tracking).

- `customization` (object) [✗]: User-defined customizations for the thumbnail.



### user-engagement-event

**Description:** User engagement and onboarding tracking events for analytics and behavioral insights.

Captures key user actions throughout their journey:
- Account creation and onboarding steps
- Feature usage and adoption
- Model management activities
- Marketplace interactions
- Subscription changes

Used for:
- User onboarding funnel analysis
- Feature adoption tracking
- User retention metrics
- A/B testing and experimentation
- Personalization and recommendations
- Product analytics dashboards


**Method:** `client.user_engagement_event(data, opts=None)`

**Payload Type:** `UserEngagementEventMessage`

**Fields:**

- `eventVersion` (string) [✓]: Schema version for forward-compatible evolution

- `eventType` (string) [✓]: Category of user engagement event

- `action` (string) [✓]: Specific user action performed

- `timestamp` (string) [✓]: ISO 8601 timestamp when the action occurred

- `userId` (string) [✓]: Unique identifier of the user

- `userEmail` (string) [✗]: User's email — MUST be SHA-256 hashed at the producer side before publishing (GDPR/CNIL compliance). Never send raw email.

- `userCreatedAt` (string) [✗]: When the user account was created (for cohort analysis)

- `userPlanTier` (string) [✗]: Current subscription plan tier

- `sessionId` (string) [✗]: User session identifier for grouping actions

- `requestId` (string) [✗]: Request ID for correlation with backend logs

- `correlationId` (string) [✗]: Correlation ID to link engagement events across frontend and backend boundaries, and to pipeline traces

- `actionDetails` (object) [✗]: Additional context about the action

- `source` (string) [✗]: Where the action originated

- `httpMethod` (string) [✗]: HTTP method used

- `httpUrl` (string) [✗]: API endpoint path

- `httpStatusCode` (integer) [✗]: HTTP response status code

- `durationMs` (number) [✗]: Action duration in milliseconds

- `experimentId` (string) [✗]: A/B test or experiment ID

- `experimentVariant` (string) [✗]: Experiment variant/group

- `environment` (string) [✗]: Deployment environment

- `clientInfo` (object) [✗]: Client/browser information (anonymized)



### worker-analytics-event

**Description:** Analytics event emitted by workers for tracking processing metrics, user behavior,
and model statistics. Consumed by worker-analytic-collector and forwarded to ELK.

All workers MUST emit this event upon job completion (success or failure).
Each worker includes its specific metrics in the `metrics` object.


**Method:** `client.worker_analytics_event(data, opts=None)`

**Payload Type:** `WorkerAnalyticsEventMessage`

**Fields:**

- `eventType` (string) [✓]: Type of analytics event

- `workerId` (string) [✓]: Identifier of the worker that processed the job

- `jobId` (string) [✓]: Unique job identifier from BullMQ

- `timestamp` (string) [✓]: ISO 8601 timestamp of event emission

- `userId` (string) [✗]: User who owns the model/triggered the job

- `modelId` (string) [✗]: Model identifier (if applicable)

- `metamodelId` (string) [✗]: Metamodel identifier (if applicable)

- `storageItemId` (string) [✗]: Storage item identifier (for download events)

- `status` (string) [✗]: Job completion status

- `errorCode` (string) [✗]: Error code if status is failure

- `errorMessage` (string) [✗]: Error message if status is failure

- `timing` (object) [✗]: Processing time metrics in milliseconds

- `metrics` (object) [✗]: Worker-specific metrics. Structure varies by eventType.



### worker-metrics-enriched-event

**Description:** Enriched metrics event for detailed worker monitoring, cost tracking,
and performance analysis. Published to backend.logging.events for
centralized monitoring and cost attribution.

This event is emitted by all workers on job completion and includes:
- LLM token usage and cost breakdown
- System resource consumption (CPU, RAM, disk I/O)
- Detailed timing breakdown by stage
- User and context attribution
- Model-specific metadata


**Method:** `client.worker_metrics_enriched_event(data, opts=None)`

**Payload Type:** `WorkerMetricsEnrichedEventMessage`

**Fields:**

- `eventType` (string) [✓]: Fixed type for enriched worker metrics

- `workerId` (string) [✓]: Identifier of the worker

- `jobId` (string) [✓]: Unique BullMQ job identifier

- `timestamp` (string) [✓]: ISO 8601 timestamp when job completed

- `status` (string) [✓]: Job completion status

- `userId` (string) [✗]: User who owns the resource/triggered the job

- `tenantId` (string) [✗]: Organization/tenant ID (for multi-tenant deployments)

- `sessionId` (string) [✗]: Session ID for correlating user actions

- `requestId` (string) [✗]: Request ID from originating API call (X-Request-Id)

- `modelId` (string) [✗]: Model ID being processed

- `metamodelId` (string) [✗]: Metamodel ID being processed

- `storageItemId` (string) [✗]: Storage item ID (for file operations)

- `timing` (object) [✗]: Comprehensive timing breakdown

- `llmUsage` (object) [✗]: LLM token usage and cost breakdown

- `resources` (object) [✗]: System resource consumption during job

- `workerMetrics` (object) [✗]: Worker-specific metrics (varies by worker type)

- `error` (object) [✗]: Error details if status is failure

- `environment` (string) [✗]: Deployment environment

- `region` (string) [✗]: Cloud region/datacenter

- `workerVersion` (string) [✗]: Worker service version

- `hostname` (string) [✗]: Pod/container hostname



## Configuration

### Environment Variables

You can use environment variables for configuration:

```python
import os
from worker_client import WorkerClient

client = WorkerClient(
    base_url=os.getenv('WORKER_BACKEND_URL', 'http://localhost:3000'),
    api_key=os.getenv('WORKER_BACKEND_API_KEY'),
    timeout=int(os.getenv('WORKER_BACKEND_TIMEOUT', '30'))
)
```

Supported environment variables:
- `WORKER_BACKEND_URL`: Base URL of the worker backend
- `WORKER_BACKEND_API_KEY`: Optional API key for authentication
- `WORKER_BACKEND_TIMEOUT`: Request timeout in seconds

### Client Options

```python
class WorkerClient:
    def __init__(
        self,
        base_url: str,        # Required: Worker backend URL
        api_key: Optional[str] = None,  # Optional: API key
        timeout: int = 30     # Optional: Request timeout in seconds
    )
```

## API Reference

### `WorkerClient`

#### Methods

- `send_to_queue(message_type: str, payload: Dict[str, Any], opts: Optional[Dict[str, Any]] = None) -> JobResponse`
  - Send a job to the queue with the specified message type
  
- `get_job_status(job_id: str) -> JobStatus`
  - Get the current status of a job


- `analytics_collection_request(data: AnalyticsCollectionRequestMessage, opts: Optional[Dict[str, Any]] = None) -> JobResponse`
  - Request to trigger a manual market data collection job.
Used for ad-hoc scraping of specific queries on marketplaces.


- `backend_logging_event(data: BackendLoggingEventMessage, opts: Optional[Dict[str, Any]] = None) -> JobResponse`
  - Centralized logging event for capturing all warn/error/failure logs from meshsync-backend.
This event is sent to ELK for centralized monitoring, alerting, and debugging.

Automatically emitted by the custom Pino logger interceptor when:
- logger.warn() is called
- logger.error() is called
- uncaught exceptions occur
- request failures happen (4xx, 5xx responses)

Used for:
- System health monitoring
- Error tracking and alerting
- Performance degradation detection
- Security incident tracking
- Compliance and audit trails


- `etsy_analytics_sync_completed(data: EtsyAnalyticsSyncCompletedMessage, opts: Optional[Dict[str, Any]] = None) -> JobResponse`
  - Contains synced analytics data for Etsy listings. Backend stores this in etsy_analytics_snapshots table and indexes to ELK.


- `etsy_analytics_sync_request(data: EtsyAnalyticsSyncRequestMessage, opts: Optional[Dict[str, Any]] = None) -> JobResponse`
  - Syncs analytics data from Etsy API for one or more listings. Fetches views, favorites, sales, revenue, and traffic source data.
Can sync: - Specific listings (provide listingIds) - All user listings (provide userId, empty listingIds) - Shop-level analytics (provide shopId)


- `etsy_publish_listing_completed(data: EtsyPublishListingCompletedMessage, opts: Optional[Dict[str, Any]] = None) -> JobResponse`
  - Indicates completion of Etsy listing publication. Contains external Etsy listing ID and URL, or error details if failed.


- `etsy_publish_listing_request(data: EtsyPublishListingRequestMessage, opts: Optional[Dict[str, Any]] = None) -> JobResponse`
  - Publishes a single metamodel listing to Etsy for a specific material variant. Creates Etsy listing, uploads digital file, and returns external listing ID.
This message is enqueued for EACH material variant when publishing a metamodel.
Example: Publishing a metamodel with PLA, Resin, ABS materials creates 3 jobs.


- `file_download_completed(data: FileDownloadCompletedMessage, opts: Optional[Dict[str, Any]] = None) -> JobResponse`
  - Notifies that a file download has been processed, indicating success or failure.

- `file_download_request(data: FileDownloadRequestMessage, opts: Optional[Dict[str, Any]] = None) -> JobResponse`
  - Downloads model file from storage provider to MinIO for processing pipeline. 
Acts as parent job for thumbnail generation, technical metadata analysis, and metadata generation.

Retry Configuration:
- Automatic retry enabled for transient failures (connection errors, timeouts)
- Default: 5 attempts with exponential backoff (2s, 4s, 8s, 16s, 32s)
- Retry on: STORAGE_TIMEOUT, NETWORK_ERROR, MINIO_UNAVAILABLE, CONNECTION_REFUSED
- No retry on: INVALID_CREDENTIALS, FILE_NOT_FOUND, PERMISSION_DENIED


- `file_vectorize_completed(data: FileVectorizeCompletedMessage, opts: Optional[Dict[str, Any]] = None) -> JobResponse`
  - Result of the vectorization process containing the embedding vector.

- `file_vectorize_request(data: FileVectorizeRequestMessage, opts: Optional[Dict[str, Any]] = None) -> JobResponse`
  - Request to generate a vector embedding for an image file using CLIP.

- `ip_check_completed(data: IpCheckCompletedMessage, opts: Optional[Dict[str, Any]] = None) -> JobResponse`
  - Contains IP verification results including trademark risk, copyright risk, detected brands/franchises, and analysis confidence scores

- `ip_check_request(data: IpCheckRequestMessage, opts: Optional[Dict[str, Any]] = None) -> JobResponse`
  - Triggers intellectual property verification analysis for a model thumbnail, detecting potential trademark and copyright issues using perceptual hashing, text analysis, and optional reverse image search.

- `marketplace_connection_sync_completed(data: MarketplaceConnectionSyncCompletedMessage, opts: Optional[Dict[str, Any]] = None) -> JobResponse`
  - Notification that marketplace connection sync has completed. Contains updated connection metadata, profile information, and sync statistics.


- `marketplace_connection_sync_request(data: MarketplaceConnectionSyncRequestMessage, opts: Optional[Dict[str, Any]] = None) -> JobResponse`
  - Requests synchronization of marketplace connection data including: - Profile information and shop details - Account status and permissions - Available categories and shipping profiles - Rate limits and API quotas
This is typically triggered after initial connection or periodically to keep marketplace metadata up to date.


- `marketplace_credential_rotation_completed(data: MarketplaceCredentialRotationCompletedMessage, opts: Optional[Dict[str, Any]] = None) -> JobResponse`
  - Notification that marketplace credential rotation has completed. Contains the rotation results, new credential metadata, and any issues encountered.


- `marketplace_credential_rotation_request(data: MarketplaceCredentialRotationRequestMessage, opts: Optional[Dict[str, Any]] = None) -> JobResponse`
  - Requests rotation/refresh of marketplace connection credentials. This is used for: - OAuth token refresh when tokens are near expiry - API key rotation for enhanced security - Re-authentication after connection errors - Scheduled credential updates


- `marketplace_intelligence_completed(data: MarketplaceIntelligenceCompletedMessage, opts: Optional[Dict[str, Any]] = None) -> JobResponse`
  - Response from marketplace intelligence scraping.
Contains aggregated similarity data from marketplace searches.

Consumed by worker-backend to update pipeline context before
sellability analysis runs.


- `marketplace_intelligence_event(data: MarketplaceIntelligenceEventMessage, opts: Optional[Dict[str, Any]] = None) -> JobResponse`
  - Public marketplace intelligence data scraped from external marketplaces.

This event contains:
- Listing details (title, price, images)
- Engagement metrics (views, favorites, reviews)
- Shop information
- Market positioning data

Unlike marketplace-listing-sync-request (private user data), this focuses on:
- Broad market trends and pricing analysis
- Competitive intelligence and demand signals
- Product popularity and sentiment

Consumed by worker-analytic-collector for Elasticsearch indexing.
Used for market research, pricing optimization, and trend detection.


- `marketplace_intelligence_request(data: MarketplaceIntelligenceRequestMessage, opts: Optional[Dict[str, Any]] = None) -> JobResponse`
  - Triggers automated marketplace scraping to find similar/competing listings
for a given model. This is a pipeline stage that runs after metadata generation
to inform sellability analysis with real market data.

The worker-analytic-collector (or marketplace-connectors worker) will:
1. Use model metadata (title, tags, category) to build search queries
2. Scrape connected marketplaces (Etsy, eBay, etc.) for similar listings
3. Emit marketplace-intelligence-event results for Elasticsearch indexing
4. Return aggregated similarity data to the pipeline context

Pipeline integration:
- Triggered after: metadata-generation (needs model title/tags/category)
- Results feed into: sellability-analysis (market positioning data)


- `marketplace_listing_description_generation_completed(data: MarketplaceListingDescriptionGenerationCompletedMessage, opts: Optional[Dict[str, Any]] = None) -> JobResponse`
  - Notifies backend that marketplace description generation completed. Contains generated description with metadata tracking (AI model, confidence, generation timestamp) and suggested price.

- `marketplace_listing_description_generation_request(data: MarketplaceListingDescriptionGenerationRequestMessage, opts: Optional[Dict[str, Any]] = None) -> JobResponse`
  - Generates SEO-optimized marketplace description for a 3D model using LLM vision analysis. Worker receives model data, technical metadata, and thumbnail URLs to generate compelling product descriptions tailored to the target marketplace.

- `marketplace_listing_sync_completed(data: MarketplaceListingSyncCompletedMessage, opts: Optional[Dict[str, Any]] = None) -> JobResponse`
  - Notification that marketplace listing sync operation has completed. Contains detailed results of the sync including created/updated listings, errors encountered, and performance statistics.


- `marketplace_listing_sync_request(data: MarketplaceListingSyncRequestMessage, opts: Optional[Dict[str, Any]] = None) -> JobResponse`
  - Requests synchronization of marketplace listings for a connection. Can sync specific listings or all listings for a marketplace connection.
Includes bidirectional sync: - Pull: Fetch listings from marketplace to update local database - Push: Update marketplace listings with local changes - Full: Both pull and push operations


- `marketplace_listing_tags_generation_completed(data: MarketplaceListingTagsGenerationCompletedMessage, opts: Optional[Dict[str, Any]] = None) -> JobResponse`
  - Notifies backend that marketplace tags generation completed. Contains generated tags optimized for discoverability with metadata tracking.

- `marketplace_listing_tags_generation_request(data: MarketplaceListingTagsGenerationRequestMessage, opts: Optional[Dict[str, Any]] = None) -> JobResponse`
  - Generates searchability tags for a 3D model optimized for marketplace discoverability. Worker creates style, technical, and usage keywords following marketplace tag limits and SEO best practices.

- `marketplace_listing_title_generation_completed(data: MarketplaceListingTitleGenerationCompletedMessage, opts: Optional[Dict[str, Any]] = None) -> JobResponse`
  - Notifies backend that marketplace title generation completed. Contains generated title with metadata tracking.

- `marketplace_listing_title_generation_request(data: MarketplaceListingTitleGenerationRequestMessage, opts: Optional[Dict[str, Any]] = None) -> JobResponse`
  - Generates marketplace-optimized title for a 3D model. Worker creates concise, SEO-friendly titles following marketplace character limits and best practices.

- `marketplace_listing_update_completed(data: MarketplaceListingUpdateCompletedMessage, opts: Optional[Dict[str, Any]] = None) -> JobResponse`
  - Result of a listing update operation

- `marketplace_listing_update_request(data: MarketplaceListingUpdateRequestMessage, opts: Optional[Dict[str, Any]] = None) -> JobResponse`
  - Request to update an existing listing on a marketplace (price, quantity, etc.)

- `media_batch_download_completed(data: MediaBatchDownloadCompletedMessage, opts: Optional[Dict[str, Any]] = None) -> JobResponse`
  - Notifies that a batch media download has been completed.

- `media_batch_download_request(data: MediaBatchDownloadRequestMessage, opts: Optional[Dict[str, Any]] = None) -> JobResponse`
  - Request to download and process a batch of media files from a storage provider. Images are compressed and resized to specified dimensions, converted to WebP format. Text files and documents are processed and stored with metadata. All processed files are uploaded to MinIO S3 storage under the media/{batchId}/ prefix.


- `metamodel_metadata_generation_completed(data: MetamodelMetadataGenerationCompletedMessage, opts: Optional[Dict[str, Any]] = None) -> JobResponse`
  - Handles metamodel metadata generation completion. Contains AI-generated metadata and aggregated technical analysis.

- `metamodel_metadata_generation_request(data: MetamodelMetadataGenerationRequestMessage, opts: Optional[Dict[str, Any]] = None) -> JobResponse`
  - Handles metamodel metadata generation requests via Ollama. Aggregates data from constituent models and generates AI-enhanced metadata.

- `model_analytics_collection_request(data: ModelAnalyticsCollectionRequestMessage, opts: Optional[Dict[str, Any]] = None) -> JobResponse`
  - Request to collect marketplace analytics for a specific metamodel.
Triggered by backend scheduler every 6 hours for popular/tagged metamodels.

Worker performs targeted market searches based on metamodel metadata
and stores aggregated statistics in Elasticsearch for trend analysis.


- `model_discovery_folder_processed_event(data: ModelDiscoveryFolderProcessedEventMessage, opts: Optional[Dict[str, Any]] = None) -> JobResponse`
  - Handles model discovery folder processed events.

- `model_discovery_scan_found_event(data: ModelDiscoveryScanFoundEventMessage, opts: Optional[Dict[str, Any]] = None) -> JobResponse`
  - Handles model discovery scan found events.

- `model_discovery_scan_progress_event(data: ModelDiscoveryScanProgressEventMessage, opts: Optional[Dict[str, Any]] = None) -> JobResponse`
  - Handles model discovery scan progress events.

- `model_discovery_scan_request(data: ModelDiscoveryScanRequestMessage, opts: Optional[Dict[str, Any]] = None) -> JobResponse`
  - Handles model discovery scan requests events.

- `model_finder_index_request(data: ModelFinderIndexRequestMessage, opts: Optional[Dict[str, Any]] = None) -> JobResponse`
  - DEPRECATED (2026-02-18) — FR-023 retired. Merge 3D rendering into worker-file-vectorize.

- `model_finder_response(data: ModelFinderResponseMessage, opts: Optional[Dict[str, Any]] = None) -> JobResponse`
  - DEPRECATED (2026-02-18) — FR-023 retired. Merge 3D rendering into worker-file-vectorize.

- `model_finder_search_request(data: ModelFinderSearchRequestMessage, opts: Optional[Dict[str, Any]] = None) -> JobResponse`
  - DEPRECATED (2026-02-18) — FR-023 retired. Merge 3D rendering into worker-file-vectorize.

- `model_metadata_generation_completed(data: ModelMetadataGenerationCompletedMessage, opts: Optional[Dict[str, Any]] = None) -> JobResponse`
  - Notifies backend that enriched marketplace metadata generation completed. Backend updates Model entity with generated description, tags, classification, etc.

- `model_metadata_generation_request(data: ModelMetadataGenerationRequestMessage, opts: Optional[Dict[str, Any]] = None) -> JobResponse`
  - Generates enriched marketplace metadata (SEO descriptions, tags, categories) for 3D models using LLM vision analysis. Worker receives all necessary data in the payload (Model, TechnicalMetadata, Thumbnails) and does NOT query the database. Prerequisites: file download, technical metadata, and thumbnail generation must be complete before this message is sent.

- `model_metamodel_detection_found(data: ModelMetamodelDetectionFoundMessage, opts: Optional[Dict[str, Any]] = None) -> JobResponse`
  - Handles model metamodel detection found with hierarchical relationships.

- `model_metamodel_detection_request(data: ModelMetamodelDetectionRequestMessage, opts: Optional[Dict[str, Any]] = None) -> JobResponse`
  - Handles model metamodel detection requests.

- `model_print_analysis_completed(data: ModelPrintAnalysisCompletedMessage, opts: Optional[Dict[str, Any]] = None) -> JobResponse`
  - Reports completion of 3D print analysis — contains estimation, printability, and cost breakdown per FR-022

- `model_print_analysis_request(data: ModelPrintAnalysisRequestMessage, opts: Optional[Dict[str, Any]] = None) -> JobResponse`
  - Triggers 3D print analysis for a model — estimates print time, material usage, support needs, and cost breakdown per FR-022

- `model_sellability_analysis_completed(data: ModelSellabilityAnalysisCompletedMessage, opts: Optional[Dict[str, Any]] = None) -> JobResponse`
  - Contains sellability analysis results including Etsy-specific recommendations, material pricing, and marketplace compatibility scores

- `model_sellability_analysis_request(data: ModelSellabilityAnalysisRequestMessage, opts: Optional[Dict[str, Any]] = None) -> JobResponse`
  - Analyzes a metamodel to determine sellability score, pricing recommendations, and optimal marketplace selection. Enhanced with Etsy-specific analysis including competitor pricing, category demand trends, and material suitability.

- `model_semantic_analysis_completed(data: ModelSemanticAnalysisCompletedMessage, opts: Optional[Dict[str, Any]] = None) -> JobResponse`
  - Handles completion of 3D model semantic analysis with generated tags and similarity results.

- `model_semantic_analysis_request(data: ModelSemanticAnalysisRequestMessage, opts: Optional[Dict[str, Any]] = None) -> JobResponse`
  - Handles 3D model semantic analysis requests using ULIP-2 neural networks and FAISS vector similarity search.

- `model_technical_metadata_completed(data: ModelTechnicalMetadataCompletedMessage, opts: Optional[Dict[str, Any]] = None) -> JobResponse`
  - Reports comprehensive results of technical metadata analysis including geometry, quality metrics, and print-readiness assessment

- `model_technical_metadata_request(data: ModelTechnicalMetadataRequestMessage, opts: Optional[Dict[str, Any]] = None) -> JobResponse`
  - Triggers comprehensive technical analysis of a 3D model file to extract geometry, quality metrics, and print-readiness information

- `slicing_fdm_request(data: SlicingFdmRequestMessage, opts: Optional[Dict[str, Any]] = None) -> JobResponse`
  - Request FDM slicing simulation via OrcaSlicer (preferred) or heuristic fallback. Accepts OrcaSlicer-compatible printer/process/filament JSON profiles.

- `slicing_fdm_result(data: SlicingFdmResultMessage, opts: Optional[Dict[str, Any]] = None) -> JobResponse`
  - Result of FDM slicing simulation from OrcaSlicer (toolpath) or heuristic fallback. Contains exact physical metrics for cost calculation.

- `slicing_sla_request(data: SlicingSlaRequestMessage, opts: Optional[Dict[str, Any]] = None) -> JobResponse`
  - Request SLA/MSLA slicing simulation via PySLM cross-sectional analysis. Accepts resin printer profile with exposure, lift, and layer parameters.

- `slicing_sla_result(data: SlicingSlaResultMessage, opts: Optional[Dict[str, Any]] = None) -> JobResponse`
  - Result of SLA/MSLA slicing simulation from PySLM cross-sectional analysis. Contains exact resin usage and print time metrics.

- `texture_generation_completed(data: TextureGenerationCompletedMessage, opts: Optional[Dict[str, Any]] = None) -> JobResponse`
  - Emitted when AI texture generation completes (success or failure). Contains artifact S3 URLs on success, or error details on failure. The credit reservation should be confirmed (success) or released (failure) based on the status.

- `texture_generation_request(data: TextureGenerationRequestMessage, opts: Optional[Dict[str, Any]] = None) -> JobResponse`
  - Request AI-powered texture generation for a 3D model. Requires a mesh file URL and a text prompt describing the desired texture. Credits are reserved before dispatch.

- `thumbnail_generation_completed(data: ThumbnailGenerationCompletedMessage, opts: Optional[Dict[str, Any]] = None) -> JobResponse`
  - Handles thumbnail generation completed.

- `thumbnail_generation_request(data: ThumbnailGenerationRequestMessage, opts: Optional[Dict[str, Any]] = None) -> JobResponse`
  - Handles thumbnail generation requests with customization options. Supports both storage provider downloads and MinIO-cached files.

- `user_engagement_event(data: UserEngagementEventMessage, opts: Optional[Dict[str, Any]] = None) -> JobResponse`
  - User engagement and onboarding tracking events for analytics and behavioral insights.

Captures key user actions throughout their journey:
- Account creation and onboarding steps
- Feature usage and adoption
- Model management activities
- Marketplace interactions
- Subscription changes

Used for:
- User onboarding funnel analysis
- Feature adoption tracking
- User retention metrics
- A/B testing and experimentation
- Personalization and recommendations
- Product analytics dashboards


- `worker_analytics_event(data: WorkerAnalyticsEventMessage, opts: Optional[Dict[str, Any]] = None) -> JobResponse`
  - Analytics event emitted by workers for tracking processing metrics, user behavior,
and model statistics. Consumed by worker-analytic-collector and forwarded to ELK.

All workers MUST emit this event upon job completion (success or failure).
Each worker includes its specific metrics in the `metrics` object.


- `worker_metrics_enriched_event(data: WorkerMetricsEnrichedEventMessage, opts: Optional[Dict[str, Any]] = None) -> JobResponse`
  - Enriched metrics event for detailed worker monitoring, cost tracking,
and performance analysis. Published to backend.logging.events for
centralized monitoring and cost attribution.

This event is emitted by all workers on job completion and includes:
- LLM token usage and cost breakdown
- System resource consumption (CPU, RAM, disk I/O)
- Detailed timing breakdown by stage
- User and context attribution
- Model-specific metadata



- `close() -> None`
  - Close the HTTP session

#### Context Manager Support

The client supports the context manager protocol for automatic resource cleanup:

```python
with WorkerClient(base_url='...') as client:
    # Use client
    pass
# Session is automatically closed
```

### Response Types

#### `JobResponse`

```python
class JobResponse:
    success: bool
    job_id: str
    message_name: str
    queue: str
```

#### `JobStatus`

```python
class JobStatus:
    job_id: str
    name: str
    queue: str
    state: str  # 'waiting' | 'active' | 'completed' | 'failed' | 'delayed'
    data: Any
    returnvalue: Optional[Any]
    progress: Optional[int]
    timestamp: int
```

## Docker Usage

A Dockerfile is included for containerized usage:

```bash
cd generated/python
docker build -t worker-client-python .
docker run -it --rm worker-client-python python
```

## License

ISC
