Open douglasg14b opened 1 year ago
A lot of services will provide JSON Schema (https://json-schema.org/) documents that define their object schemas.
Example:
{ "$id": "https://events-schemas.twilio.com/TaskRouter.WDSEvent/2", "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "definitions": { "WDSEventData": { "additionalProperties": false, "description": "WSDEvent event payload definition", "properties": { "account_sid": { "description": "Account SID", "type": "string" }, "event_description": { "description": "Event description", "type": "string" }, "eventtype": { "description": "Event type", "type": "string" }, "previous_task_priority": { "description": "Previous task priority", "type": "integer" }, "previous_task_queue_name": { "description": "Previous task queue name", "type": "string" }, "previous_task_queue_sid": { "description": "Previous task queue SID", "type": "string" }, "reason": { "description": "Reason", "type": "string" }, "reservation_reason_code": { "description": "Reservation reason code", "type": "integer" }, "reservation_sid": { "description": "Reservation SID", "type": "string" }, "reservation_version": { "description": "Reservation version", "type": "integer" }, "resource_sid": { "description": "Resource SID", "type": "string" }, "resource_type": { "description": "Resource type", "type": "string" }, "sid": { "description": "SID", "type": "string" }, "target_changed_reason": { "description": "Target changed reason", "type": "string" }, "task_age": { "description": "Task age", "type": "integer" }, "task_age_in_queue": { "description": "Task age in queue", "type": "integer" }, "task_assignment_status": { "description": "Task assignment status", "type": "string" }, "task_attributes": { "description": "Task attributes", "type": "string" }, "task_canceled_reason": { "description": "Task canceled reason", "type": "string" }, "task_channel_sid": { "description": "Task channel SID", "type": "string" }, "task_channel_unique_name": { "description": "Task Channel unique name", "type": "string" }, "task_completed_reason": { "description": "Task completed reason", "type": "string" }, "task_date_created": { "description": "Task date created", "type": "string" }, "task_priority": { "description": "Task Priority", "type": "integer" }, "task_queue_entered_date": { "description": "Task queue entered date", "type": "string" }, "task_queue_name": { "description": "Task queue name", "type": "string" }, "task_queue_sid": { "description": "Task queue SID", "type": "string" }, "task_queue_target_expression": { "description": "Task queue target expression", "type": "string" }, "task_re_evaluated_reason": { "description": "Task reevaluated reason", "type": "string" }, "task_routing_target": { "description": "Task routing target", "type": "string" }, "task_sid": { "description": "Task SID", "type": "string" }, "task_transfer_sid": { "description": "Task transfer SID", "type": "string" }, "task_version": { "description": "Task version", "type": "integer" }, "timestamp": { "description": "Timestamp", "type": "string" }, "transfer_failed_reason": { "description": "Transfer failed reason", "type": "string" }, "transfer_initiating_reservation_sid": { "description": "Transfer initiating reservation SID", "type": "string" }, "transfer_initiating_worker_sid": { "description": "Transfer initiating worker SID", "type": "string" }, "transfer_mode": { "description": "Transfer mode", "type": "string" }, "transfer_started": { "description": "Transfer started", "type": "string" }, "transfer_status": { "description": "Transfer status", "type": "string" }, "transfer_to": { "description": "Transfer to", "type": "string" }, "transfer_type": { "description": "Transfer type", "type": "string" }, "worker_activity_name": { "description": "Worker activity name", "type": "string" }, "worker_activity_sid": { "description": "Worker activity SID", "type": "string" }, "worker_attributes": { "description": "Worker attributes", "type": "string" }, "worker_channel_available": { "description": "Worker channel available", "type": "integer" }, "worker_channel_available_capacity": { "description": "Worker channel available capacity", "type": "number" }, "worker_channel_capacity": { "description": "Worker channel capacity", "type": "integer" }, "worker_channel_previous_capacity": { "description": "Worker channel previous capacity", "type": "number" }, "worker_channel_task_count": { "description": "Worker channel task count", "type": "integer" }, "worker_name": { "description": "Worker name", "type": "string" }, "worker_previous_activity_name": { "description": "Worker previous activity name", "type": "string" }, "worker_previous_activity_sid": { "description": "Worker previous activity SID", "type": "string" }, "worker_sid": { "description": "Worker SID", "type": "string" }, "worker_time_in_previous_activity": { "description": "Worker time in previous activity in seconds", "type": "integer" }, "worker_time_in_previous_activity_ms": { "description": "Worker time in previous activity in millis", "type": "integer" }, "workflow_filter_expression": { "description": "Workflow filter expression", "type": "string" }, "workflow_filter_name": { "description": "Workflow filter name", "type": "string" }, "workflow_filter_target_expression": { "description": "Workflow filter target expression", "type": "string" }, "workflow_filter_target_name": { "description": "Workflow filter name", "type": "string" }, "workflow_name": { "description": "Workflow name", "type": "string" }, "workflow_sid": { "description": "Workflow SID", "type": "string" }, "workspace_name": { "description": "Worspace name", "type": "string" }, "workspace_sid": { "description": "Workspace SID", "type": "string" } }, "required": [ "sid", "eventtype", "account_sid", "timestamp", "workspace_sid", "workspace_name" ], "type": "object" } }, "description": "WSDEvent event definition", "properties": { "account_friendly_name": { "description": "Account friendly name", "type": "string" }, "account_sid": { "description": "Account SID", "type": "string" }, "group": { "description": "Group", "type": "string" }, "level": { "description": "Level", "type": "string" }, "name": { "description": "name", "type": "string" }, "parent_account_sid": { "description": "Parent account SID", "type": "string" }, "parent_friendly_name": { "description": "Parent account friendly name", "type": "string" }, "payload": { "$ref": "#/definitions/WDSEventData" }, "payload_type": { "description": "Payload type", "type": "string" }, "product_name": { "description": "Product name", "type": "string" }, "publisher": { "description": "Publisher", "type": "string" }, "publisher_metadata": { "description": "Publisher metadata", "type": "string" }, "sid": { "description": "SID", "type": "string" }, "timestamp": { "description": "Timestamp", "type": "string" } }, "required": [ "sid", "name", "account_sid", "timestamp", "level", "group", "product_name", "publisher", "payload_type", "payload" ], "title": "WSDEvent", "type": "object" }
What's your expectations? Are we only adding the schema attributes in the input? Can you provide example input and expected c# output.
A lot of services will provide JSON Schema (https://json-schema.org/) documents that define their object schemas.
Example: