using System.Collections.Generic; using Newtonsoft.Json; namespace OrderSupportTicket.Models.Api; /// /// 创建工单请求。 /// internal sealed class CreateWorkOrderRequest { /// /// 拍单账号。 /// ////[JsonProperty("purchaseAccount")] public string PurchaseAccount { get; set; } /// /// 订单所属店铺 APPID。 /// ////[JsonProperty("appId")] public string AppId { get; set; } /// /// 微信订单号,保持为数字字符串。 /// ////[JsonProperty("wechatOrderId")] public string WechatOrderId { get; set; } /// /// 首条问题描述,长度 1~2000 字。 /// ////[JsonProperty("description")] public string Description { get; set; } /// /// 可选的创建幂等编号。 /// ////[JsonProperty("clientRequestId", NullValueHandling = NullValueHandling.Ignore)] public string ClientRequestId { get; set; } } /// /// 工单摘要列表请求。 /// internal sealed class ListWorkOrdersRequest { /// /// 拍单账号。 /// ////[JsonProperty("purchaseAccount")] public string PurchaseAccount { get; set; } /// /// 要查询的店铺 APPID 数组。 /// ////[JsonProperty("appIds")] public IList AppIds { get; set; } /// /// 可选的微信订单号精确筛选条件。 /// ////[JsonProperty("wechatOrderId", NullValueHandling = NullValueHandling.Ignore)] public string WechatOrderId { get; set; } /// /// 可选的工单状态筛选条件。 /// ////[JsonProperty("status", NullValueHandling = NullValueHandling.Ignore)] public string Status { get; set; } /// /// 本页最大返回数量,范围 1~100。 /// ////[JsonProperty("limit")] public int Limit { get; set; } /// /// 下一页游标,使用服务端返回的原始值。 /// ////[JsonProperty("cursor", NullValueHandling = NullValueHandling.Ignore)] public string Cursor { get; set; } } /// /// 查询订单留言板请求。 /// internal sealed class GetMessagesRequest { /// /// 拍单账号。 /// ////[JsonProperty("purchaseAccount")] public string PurchaseAccount { get; set; } /// /// 微信订单号,保持为数字字符串。 /// ////[JsonProperty("wechatOrderId")] public string WechatOrderId { get; set; } /// /// 订单所属店铺 APPID。 /// ////[JsonProperty("appId")] public string AppId { get; set; } /// /// 本页最大返回数量,范围 1~100。 /// ////[JsonProperty("limit")] public int Limit { get; set; } /// /// 加载更早留言时使用的 before 游标。 /// ////[JsonProperty("before", NullValueHandling = NullValueHandling.Ignore)] public string Before { get; set; } } /// /// 提交客户留言请求。 /// internal sealed class SendMessageRequest { /// /// 拍单账号。 /// ////[JsonProperty("purchaseAccount")] public string PurchaseAccount { get; set; } /// /// 订单所属店铺 APPID。 /// ////[JsonProperty("appId")] public string AppId { get; set; } /// /// 留言幂等编号。 /// ////[JsonProperty("clientMessageId")] public string ClientMessageId { get; set; } /// /// 留言正文;有图片附件时可为空。 /// ////[JsonProperty("text")] public string Text { get; set; } /// /// 图片上传回执,最多 3 个;无图片时为 null,序列化时省略。 /// ////[JsonProperty("attachments")] public IList Attachments { get; set; } } /// /// 标记留言已读请求。 /// internal sealed class MarkReadRequest { /// /// 拍单账号。 /// ////[JsonProperty("purchaseAccount")] public string PurchaseAccount { get; set; } /// /// 订单所属店铺 APPID。 /// ////[JsonProperty("appId")] public string AppId { get; set; } /// /// 已读到的最大留言序号。 /// ////[JsonProperty("throughSequenceNo")] public int ThroughSequenceNo { get; set; } } /// /// 申请图片直传凭证请求。 /// internal sealed class CreateImageUploadTicketRequest { /// /// 拍单账号。 /// public string PurchaseAccount { get; set; } /// /// 订单所属店铺 APPID。 /// public string AppId { get; set; } /// /// 原始文件名,1~180 字符。 /// public string FileName { get; set; } /// /// 精确的图片 MIME 类型:image/jpeg、image/png 或 image/webp。 /// public string MimeType { get; set; } /// /// 图片实际字节数,1~5,242,880。 /// public long Size { get; set; } /// /// 可选的上传标识;省略时由服务端生成。 /// public string RequestId { get; set; } } /// /// 图片直传凭证响应。 /// public sealed class ImageUploadTicketResponse { /// /// 请求是否成功。 /// public bool Success { get; set; } /// /// 本次上传的凭证信息。 /// public ImageUploadTicketDto Upload { get; set; } /// /// 订单所属店铺 APPID。 /// public string AppId { get; set; } /// /// 微信订单号。 /// public string WechatOrderId { get; set; } /// /// 接口返回的身份校验标记,当前恒为 false。 /// public bool IdentityVerified { get; set; } /// /// 本次 HTTP 请求的排查编号;不是 upload.requestId。 /// public string RequestId { get; set; } } /// /// 服务端签发的单次图片直传凭证。 /// public sealed class ImageUploadTicketDto { /// /// 上传模式,文档约定为 single。 /// public string Mode { get; set; } /// /// 上传 HTTP 方法,文档约定为 PUT。 /// public string Method { get; set; } /// /// 本次图片上传标识。 /// public string RequestId { get; set; } /// /// 服务端签发的上传凭证,需原样提交留言接口。 /// public string Ticket { get; set; } /// /// 带短时签名的 COS 上传地址。 /// public string UploadUrl { get; set; } /// /// 直传时必须原样携带的请求头。 /// public Dictionary Headers { get; set; } /// /// 上传凭证过期时间。 /// public string ExpiresAt { get; set; } } /// /// 图片直传完成后提交给留言接口的回执。 /// public sealed class MessageAttachmentReceipt { /// /// 原样使用 upload.requestId。 /// public string RequestId { get; set; } /// /// 原样使用 upload.ticket。 /// public string Ticket { get; set; } /// /// 可选的 COS 响应 ETag。 /// public string Etag { get; set; } } /// /// 留言中的公开图片附件。 /// public sealed class TicketAttachmentDto { /// /// 附件唯一 ID。 /// public string Id { get; set; } /// /// 原始文件名。 /// public string OriginalName { get; set; } /// /// 图片 MIME 类型。 /// public string ContentType { get; set; } /// /// 图片字节数。 /// public long ByteSize { get; set; } /// /// 图片创建时间。 /// public string CreatedAt { get; set; } /// /// 短时读取地址;暂不可用时为 null。 /// public string ReadUrl { get; set; } } /// /// 工单摘要分页响应。 /// public sealed class WorkOrderListResponse { /// /// 请求是否成功。 /// ////[JsonProperty("success")] public bool Success { get; set; } /// /// 当前页工单摘要。 /// ////[JsonProperty("items")] public List Items { get; set; } /// /// 是否还有下一页。 /// ////[JsonProperty("hasMore")] public bool HasMore { get; set; } /// /// 下一页游标。 /// ////[JsonProperty("nextCursor")] public string NextCursor { get; set; } /// /// 接口返回的身份校验标记,当前恒为 false。 /// ////[JsonProperty("identityVerified")] public bool IdentityVerified { get; set; } } /// /// 单个订单的工单摘要。 /// public sealed class WorkOrderSummaryDto { /// /// 订单所属店铺 APPID。 /// ////[JsonProperty("appId")] public string AppId { get; set; } /// /// 微信订单号,保持为数字字符串。 /// ////[JsonProperty("wechatOrderId")] public string WechatOrderId { get; set; } /// /// 工单状态编码。 /// ////[JsonProperty("status")] public string Status { get; set; } /// /// 工单状态中文文本。 /// ////[JsonProperty("statusText")] public string StatusText { get; set; } /// /// 工单创建时间,由接口以 ISO 8601 字符串传输。 /// ////[JsonProperty("createdAt")] public string CreatedAt { get; set; } /// /// 工单更新时间,由接口以 ISO 8601 字符串传输。 /// ////[JsonProperty("updatedAt")] public string UpdatedAt { get; set; } /// /// 最近一条公开留言时间,由接口以 ISO 8601 字符串传输。 /// ////[JsonProperty("lastMessageAt")] public string LastMessageAt { get; set; } /// /// 最近一次客服正式回复时间;从未回复时为 null。 /// ////[JsonProperty("lastReplyAt")] public string LastReplyAt { get; set; } /// /// 最近一条公开留言的发送方类型。 /// ////[JsonProperty("lastSenderType")] public string LastSenderType { get; set; } /// /// 未读留言数量。 /// ////[JsonProperty("unreadCount")] public int UnreadCount { get; set; } /// /// 工单版本号,按接口返回的字符串原样保存。 /// ////[JsonProperty("version")] public string Version { get; set; } } /// /// 订单留言板响应。 /// public sealed class WorkOrderMessagesResponse { /// /// 请求是否成功。 /// ////[JsonProperty("success")] public bool Success { get; set; } /// /// 订单所属店铺 APPID。 /// ////[JsonProperty("appId")] public string AppId { get; set; } /// /// 微信订单号。 /// ////[JsonProperty("wechatOrderId")] public string WechatOrderId { get; set; } /// /// 当前页公开留言,按 sequenceNo 升序排列。 /// ////[JsonProperty("items")] public List Items { get; set; } /// /// 是否还有更早的留言。 /// ////[JsonProperty("hasMore")] public bool HasMore { get; set; } /// /// 加载更早留言时使用的 before 游标。 /// ////[JsonProperty("nextBefore")] public string NextBefore { get; set; } /// /// 接口返回的身份校验标记,当前恒为 false。 /// ////[JsonProperty("identityVerified")] public bool IdentityVerified { get; set; } } /// /// 单条公开留言。 /// public sealed class TicketMessageDto { /// /// 消息唯一 ID,用于去重。 /// ////[JsonProperty("messageId")] public string MessageId { get; set; } /// /// 工单内连续递增的消息序号。 /// ////[JsonProperty("sequenceNo")] public int SequenceNo { get; set; } /// /// 发送方类型,例如 customer。 /// ////[JsonProperty("senderType")] public string SenderType { get; set; } /// /// 发送方显示名称。 /// ////[JsonProperty("senderName")] public string SenderName { get; set; } /// /// 留言正文;消息撤回后为空字符串。 /// ////[JsonProperty("text")] public string Text { get; set; } /// /// 消息是否已撤回。 /// ////[JsonProperty("recalled")] public bool Recalled { get; set; } /// /// 消息发送时间,由接口以 ISO 8601 字符串传输。 /// ////[JsonProperty("createdAt")] public string CreatedAt { get; set; } /// /// 公开图片附件;无图片时为空数组。 /// ////[JsonProperty("attachments")] public List Attachments { get; set; } } /// /// 创建工单响应。 /// public sealed class CreateWorkOrderResponse { /// /// 请求是否成功。 /// ////[JsonProperty("success")] public bool Success { get; set; } /// /// 创建结果,取值 created、existing 或 reopened。 /// ////[JsonProperty("operation")] public string Operation { get; set; } /// /// 订单所属店铺 APPID。 /// ////[JsonProperty("appId")] public string AppId { get; set; } /// /// 微信订单号。 /// ////[JsonProperty("wechatOrderId")] public string WechatOrderId { get; set; } /// /// 操作后的工单状态。 /// ////[JsonProperty("status")] public string Status { get; set; } /// /// 创建或重开时追加的首条消息 ID。 /// ////[JsonProperty("messageId")] public string MessageId { get; set; } /// /// 操作后的工单版本号字符串。 /// ////[JsonProperty("version")] public string Version { get; set; } /// /// 是否为幂等编号对应的历史回执。 /// ////[JsonProperty("replayed")] public bool Replayed { get; set; } /// /// 接口返回的身份校验标记,当前恒为 false。 /// ////[JsonProperty("identityVerified")] public bool IdentityVerified { get; set; } } /// /// 提交客户留言响应。 /// public sealed class SendMessageResponse { /// /// 请求是否成功。 /// ////[JsonProperty("success")] public bool Success { get; set; } /// /// 订单所属店铺 APPID。 /// ////[JsonProperty("appId")] public string AppId { get; set; } /// /// 微信订单号。 /// ////[JsonProperty("wechatOrderId")] public string WechatOrderId { get; set; } /// /// 服务端正式生成的消息对象。 /// ////[JsonProperty("message")] public TicketMessageDto Message { get; set; } /// /// 留言后的工单状态。 /// ////[JsonProperty("status")] public string Status { get; set; } /// /// 留言后的工单版本号字符串。 /// ////[JsonProperty("version")] public string Version { get; set; } /// /// 本次留言是否重新开启了已完结工单。 /// ////[JsonProperty("reopened")] public bool Reopened { get; set; } /// /// 是否为幂等编号对应的历史回执。 /// ////[JsonProperty("replayed")] public bool Replayed { get; set; } /// /// 接口返回的身份校验标记,当前恒为 false。 /// ////[JsonProperty("identityVerified")] public bool IdentityVerified { get; set; } } /// /// 通用成功状态响应,仅用于在解析具体业务对象前检查顶层 success。 /// internal sealed class ApiSuccessResponse { /// /// 请求是否成功。 /// ////[JsonProperty("success")] public bool Success { get; set; } } /// /// 工单接口错误响应。 /// internal sealed class ApiErrorResponse { /// /// 请求是否成功,错误响应通常为 false。 /// ////[JsonProperty("success")] public bool Success { get; set; } /// /// 可展示给用户的错误说明。 /// ////[JsonProperty("message")] public string Message { get; set; } /// /// 兼容旧接口的错误说明字段。 /// ////[JsonProperty("error")] public string Error { get; set; } /// /// 服务端错误编码。 /// ////[JsonProperty("code")] public string Code { get; set; } }