Skip to content

Commit 2ca003f

Browse files
committed
feat(tiktokshop): 新增获取授权的类目资产列表接口
1 parent 7f454d2 commit 2ca003f

6 files changed

Lines changed: 142 additions & 0 deletions

File tree

docs/TikTokGlobalShop/Basic_ModelDefinition.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Notes: The following catalog is consistent with the catalog structure of [TikTok
2020
- Get Access Token: `AuthGetToken`
2121
- Refresh Access Token: `AuthRefreshToken`
2222
- Authorization
23+
- Get Authorized Category Assets: `AuthorizationGetCategoryAssets`
2324
- Get Authorized Shops: `AuthorizationGetShops`
2425
- Event
2526
- Get Shop Webhooks: `EventGetWebhooks`

src/SKIT.FlurlHttpClient.ByteDance.TikTokGlobalShop/Extensions/TikTokShopClientExecuteAuthorizationExtensions.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,27 @@ public static class TikTokShopClientExecuteAuthorizationExtensions
2929

3030
return await client.SendFlurlRequesAsJsontAsync<Models.AuthorizationGetShopsResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
3131
}
32+
33+
/// <summary>
34+
/// <para>异步调用 [GET] /authorization/{version}/category_assets 接口。</para>
35+
/// <para>
36+
/// REF: <br/>
37+
/// <![CDATA[ https://partner.tiktokshop.com/docv2/page/666012dd609d4402cc3be995 ]]>
38+
/// </para>
39+
/// </summary>
40+
/// <param name="client"></param>
41+
/// <param name="request"></param>
42+
/// <param name="cancellationToken"></param>
43+
/// <returns></returns>
44+
public static async Task<Models.AuthorizationGetCategoryAssetsResponse> ExecuteAuthorizationGetCategoryAssetsAsync(this TikTokShopClient client, Models.AuthorizationGetCategoryAssetsRequest request, CancellationToken cancellationToken = default)
45+
{
46+
if (client is null) throw new ArgumentNullException(nameof(client));
47+
if (request is null) throw new ArgumentNullException(nameof(request));
48+
49+
IFlurlRequest flurlReq = client
50+
.CreateFlurlRequest(request, HttpMethod.Get, "authorization", request.ApiVersion, "category_assets");
51+
52+
return await client.SendFlurlRequesAsJsontAsync<Models.AuthorizationGetCategoryAssetsResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
53+
}
3254
}
3355
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
namespace SKIT.FlurlHttpClient.ByteDance.TikTokGlobalShop.Models
2+
{
3+
/// <summary>
4+
/// <para>表示 [GET] /authorization/{version}/category_assets 接口的请求。</para>
5+
/// </summary>
6+
public class AuthorizationGetCategoryAssetsRequest : TikTokShopRequest
7+
{
8+
/// <summary>
9+
/// 获取或设置 API 版本号。
10+
/// <para>默认值:202405</para>
11+
/// </summary>
12+
[Newtonsoft.Json.JsonIgnore]
13+
[System.Text.Json.Serialization.JsonIgnore]
14+
public override int ApiVersion { get; set; } = 202405;
15+
}
16+
}
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
namespace SKIT.FlurlHttpClient.ByteDance.TikTokGlobalShop.Models
2+
{
3+
/// <summary>
4+
/// <para>表示 [GET] /authorization/{version}/category_assets 接口的响应。</para>
5+
/// </summary>
6+
public class AuthorizationGetCategoryAssetsResponse : TikTokShopResponse<AuthorizationGetCategoryAssetsResponse.Types.Data>
7+
{
8+
public static class Types
9+
{
10+
public class Data
11+
{
12+
public static class Types
13+
{
14+
public class CategoryAsset
15+
{
16+
public static class Types
17+
{
18+
public class Category
19+
{
20+
/// <summary>
21+
/// 获取或设置类目 ID。
22+
/// </summary>
23+
[Newtonsoft.Json.JsonProperty("id")]
24+
[System.Text.Json.Serialization.JsonPropertyName("id")]
25+
[System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)]
26+
public int CategoryId { get; set; }
27+
28+
/// <summary>
29+
/// 获取或设置类目名称。
30+
/// </summary>
31+
[Newtonsoft.Json.JsonProperty("name")]
32+
[System.Text.Json.Serialization.JsonPropertyName("name")]
33+
public string Name { get; set; } = default!;
34+
}
35+
}
36+
37+
/// <summary>
38+
/// 获取或设置店铺密码。
39+
/// </summary>
40+
[Newtonsoft.Json.JsonProperty("cipher")]
41+
[System.Text.Json.Serialization.JsonPropertyName("cipher")]
42+
public string Cipher { get; set; } = default!;
43+
44+
/// <summary>
45+
/// 获取或设置目标市场。
46+
/// </summary>
47+
[Newtonsoft.Json.JsonProperty("target_market")]
48+
[System.Text.Json.Serialization.JsonPropertyName("target_market")]
49+
public string TargetMarket { get; set; } = default!;
50+
51+
/// <summary>
52+
/// 获取或设置类目信息。
53+
/// </summary>
54+
[Newtonsoft.Json.JsonProperty("category")]
55+
[System.Text.Json.Serialization.JsonPropertyName("category")]
56+
public Types.Category Category { get; set; } = default!;
57+
}
58+
}
59+
60+
/// <summary>
61+
/// 获取或设置类目资产列表。
62+
/// </summary>
63+
[Newtonsoft.Json.JsonProperty("category_assets")]
64+
[System.Text.Json.Serialization.JsonPropertyName("category_assets")]
65+
public Types.CategoryAsset[] CategoryAssetList { get; set; } = default!;
66+
}
67+
}
68+
}
69+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"code": 0,
3+
"data": {
4+
"category_assets": [
5+
{
6+
"category": {
7+
"id": 3,
8+
"name": "Customer Support"
9+
},
10+
"cipher": "TTP_XF90igAAAABh0sddwer0qsWgt233vOiG",
11+
"target_market": "US"
12+
}
13+
]
14+
},
15+
"message": "Success",
16+
"request_id": "202203070749000101890810281E8C70B7"
17+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"code": 0,
3+
"data": {
4+
"shops": [
5+
{
6+
"cipher": "GCP_XF90igAAAABh00qsWgtvOiGFNqyubMt3",
7+
"code": "CNGBCBA4LLU8",
8+
"id": "7000714532876273420",
9+
"name": "Maomao beauty shop",
10+
"region": "GB",
11+
"seller_type": "CROSS_BORDER"
12+
}
13+
]
14+
},
15+
"message": "Success",
16+
"request_id": "202203070749000101890810281E8C70B7"
17+
}

0 commit comments

Comments
 (0)