Skip to content

Commit

Permalink
feat(tiktokshop): 随官方更新商品相关接口模型
Browse files Browse the repository at this point in the history
  • Loading branch information
fudiwei committed Nov 8, 2024
1 parent d227484 commit 7f454d2
Show file tree
Hide file tree
Showing 9 changed files with 180 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,9 @@ public static class TikTokShopClientExecuteProductExtensions
IFlurlRequest flurlReq = client
.CreateFlurlRequest(request, HttpMethod.Post, "product", request.ApiVersion, "products", "listing_check");

if (request.IsDiagnosisRequired is not null)
flurlReq.SetQueryParam("is_diagnosis_required", request.IsDiagnosisRequired.Value ? "true" : "false");

return await client.SendFlurlRequesAsJsontAsync<Models.ProductCreateProductListingCheckResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,13 @@ public class Manufacturer : ProductCreateProductRequest.Types.Manufacturer
}
}

/// <summary>
/// 获取或设置是否返回优化诊断结果。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public bool? IsDiagnosisRequired { get; set; }

/// <summary>
/// 获取或设置外部商品 ID。
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ public static class Types
{
public class FailReason
{
/// <summary>
/// 获取或设置失败原因编码。
/// </summary>
[Newtonsoft.Json.JsonProperty("code")]
[System.Text.Json.Serialization.JsonPropertyName("code")]
public int Code { get; set; }

/// <summary>
/// 获取或设置失败原因。
/// </summary>
Expand All @@ -24,6 +31,45 @@ public class FailReason
public class Warning : ProductCreateProductResponse.Types.Data.Types.Warning
{
}

public class Diagnosis
{
public static class Types
{
public class DiagnosisResult : ProductGetProductDiagnosesResponse.Types.Data.Types.Product.Types.Diagnosis.Types.DiagnosisResult
{
}

public class Suggestion : ProductGetProductDiagnosesResponse.Types.Data.Types.Product.Types.Diagnosis.Types.Suggestion
{
}
}

/// <summary>
/// 获取或设置字段。
/// </summary>
[Newtonsoft.Json.JsonProperty("field")]
[System.Text.Json.Serialization.JsonPropertyName("field")]
public string Field { get; set; } = default!;

/// <summary>
/// 获取或设置诊断结果列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("diagnosis_results")]
[System.Text.Json.Serialization.JsonPropertyName("diagnosis_results")]
public Types.DiagnosisResult[] DiagnosisResultList { get; set; } = default!;

/// <summary>
/// 获取或设置修改建议。
/// </summary>
[Newtonsoft.Json.JsonProperty("suggestions")]
[System.Text.Json.Serialization.JsonPropertyName("suggestions")]
public Types.Suggestion? Suggestion { get; set; }
}

public class ListingQuality : ProductGetProductDiagnosesResponse.Types.Data.Types.Product.Types.ListingQuality
{
}
}

/// <summary>
Expand All @@ -46,6 +92,20 @@ public class Warning : ProductCreateProductResponse.Types.Data.Types.Warning
[Newtonsoft.Json.JsonProperty("warnings")]
[System.Text.Json.Serialization.JsonPropertyName("warnings")]
public Types.Warning? Warning { get; set; }

/// <summary>
/// 获取或设置诊断列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("diagnoses")]
[System.Text.Json.Serialization.JsonPropertyName("diagnoses")]
public Types.Diagnosis[]? DiagnosisList { get; set; }

/// <summary>
/// 获取或设置上架质量信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("listing_quality")]
[System.Text.Json.Serialization.JsonPropertyName("listing_quality")]
public Types.ListingQuality? ListingQuality { get; set; }
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -898,6 +898,13 @@ public class AuditFailedReason
[Newtonsoft.Json.JsonProperty("audit_failed_reasons")]
[System.Text.Json.Serialization.JsonPropertyName("audit_failed_reasons")]
public Types.AuditFailedReason[]? AuditFailedReasonList { get; set; }

/// <summary>
/// 获取或设置上架质量等级。
/// </summary>
[Newtonsoft.Json.JsonProperty("listing_quality_tier")]
[System.Text.Json.Serialization.JsonPropertyName("listing_quality_tier")]
public string? ListingQualityTier { get; set; }
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ public class DiagnosisResult
[Newtonsoft.Json.JsonProperty("how_to_solve")]
[System.Text.Json.Serialization.JsonPropertyName("how_to_solve")]
public string HowToSolve { get; set; } = default!;

/// <summary>
/// 获取或设置质量等级。
/// </summary>
[Newtonsoft.Json.JsonProperty("quality_tier")]
[System.Text.Json.Serialization.JsonPropertyName("quality_tier")]
public string? QualityTier { get; set; }
}

public class Suggestion
Expand Down Expand Up @@ -150,6 +157,23 @@ public class Image
[System.Text.Json.Serialization.JsonPropertyName("suggestion")]
public Types.Suggestion? Suggestion { get; set; }
}

public class ListingQuality
{
/// <summary>
/// 获取或设置当前等级。
/// </summary>
[Newtonsoft.Json.JsonProperty("current_tier")]
[System.Text.Json.Serialization.JsonPropertyName("current_tier")]
public string CurrentTier { get; set; } = default!;

/// <summary>
/// 获取或设置剩余建议数量。
/// </summary>
[Newtonsoft.Json.JsonProperty("remaining_recommendations")]
[System.Text.Json.Serialization.JsonPropertyName("remaining_recommendations")]
public int RemainingRecommendationCount { get; set; } = default!;
}
}

/// <summary>
Expand All @@ -166,6 +190,13 @@ public class Image
[Newtonsoft.Json.JsonProperty("diagnoses")]
[System.Text.Json.Serialization.JsonPropertyName("diagnoses")]
public Types.Diagnosis[] DiagnosisList { get; set; } = default!;

/// <summary>
/// 获取或设置上架质量信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("listing_quality")]
[System.Text.Json.Serialization.JsonPropertyName("listing_quality")]
public Types.ListingQuality? ListingQuality { get; set; }
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ public class ProductSearchProductsRequest : TikTokShopRequest
[System.Text.Json.Serialization.JsonPropertyName("update_time_le")]
public long? UpdateTimestampLessThan { get; set; }

/// <summary>
/// 获取或设置分类版本。
/// </summary>
[Newtonsoft.Json.JsonProperty("category_version")]
[System.Text.Json.Serialization.JsonPropertyName("category_version")]
public string? CategoryVersion { get; set; }

/// <summary>
/// 获取或设置商品状态。
/// </summary>
Expand All @@ -57,6 +64,20 @@ public class ProductSearchProductsRequest : TikTokShopRequest
[System.Text.Json.Serialization.JsonPropertyName("seller_skus")]
public IList<string>? SellerSKUList { get; set; }

/// <summary>
/// 获取或设置上架质量等级。
/// </summary>
[Newtonsoft.Json.JsonProperty("listing_quality_tier")]
[System.Text.Json.Serialization.JsonPropertyName("listing_quality_tier")]
public string? ListingQualityTier { get; set; }

/// <summary>
/// 获取或设置上架平台列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("listing_platforms")]
[System.Text.Json.Serialization.JsonPropertyName("listing_platforms")]
public IList<string>? ListingPlatformList { get; set; }

/// <summary>
/// 获取或设置分页每页数量。
/// <para>默认值:10</para>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,50 @@
"code": 0,
"data": {
"check_result": "FAILED",
"diagnoses": [
{
"diagnosis_results": [
{
"code": "TITLE_LESS_THAN_40_CHARACTERS",
"how_to_solve": "Names must be at least 40 characters long and contain product-identifying information, such as \"hiking boots\" or \"lipstick\".",
"quality_tier": "POOR"
}
],
"field": "TITLE",
"suggestions": {
"images": [
{
"height": 600,
"optimized_uri": "tos-maliva-i-o3syd03w52-us/0266127022264e54ad2f639f5e0fb5e6",
"optimized_url": "https://p16-graph-va.ibyteimg.com/tos-maliva-i-1por3rr4fy-us/v2/0266127022264e54ad2f639f5e0fb5e6~tplv-1por3rr4fy-image.webp",
"uri": "tos-maliva-i-o3syd03w52-us/53b55d6e8cdf1f315affa7e70b45707d",
"url": "https://p16-graph-va.ibyteimg.com/tos-maliva-i-1por3rr4fy-us/v2/53b55d6e8cdf1f315affa7e70b45707d~tplv-1por3rr4fy-image.webp",
"width": 600
}
],
"seo_words": [
{
"text": "dress"
}
],
"smart_texts": [
{
"text": "this is a good title"
}
]
}
}
],
"fail_reasons": [
{
"code": 12052700,
"message": "Product title invalid"
}
],
"listing_quality": {
"current_tier": "POOR",
"remaining_recommendations": 3
},
"warnings": {
"message": "Your product will not be sent for review. "
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"diagnosis_results": [
{
"code": "TITLE_LESS_THAN_40_CHARACTERS",
"how_to_solve": "Names must be at least 40 characters long and contain product-identifying information, such as \"hiking boots\" or \"lipstick\"."
"how_to_solve": "Names must be at least 40 characters long and contain product-identifying information, such as \"hiking boots\" or \"lipstick\".",
"quality_tier": "GOOD"
}
],
"field": "TITLE",
Expand Down Expand Up @@ -36,7 +37,11 @@
}
}
],
"id": "123456"
"id": "123456",
"listing_quality": {
"current_tier": "POOR",
"remaining_recommendations": 3
}
}
]
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
{
"category_version": "v1",
"create_time_ge": 1694309208,
"create_time_le": 1694319208,
"listing_platforms": [
"TIKTOK_SHOP"
],
"listing_quality_tier": "POOR",
"seller_skus": [
"Color-Red-XM001"
],
Expand Down

0 comments on commit 7f454d2

Please sign in to comment.