Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] TikTok Shop API Upgrade to v202309 #31

Merged
merged 15 commits into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
119 changes: 119 additions & 0 deletions docs/TikTokGlobalShop/Basic_LegacyAPI.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
## Legacy API (pre-v202309)

Legacy API versions (pre-v202309) will no longer be supported or maintained from 2024-06-30 and will be retired on 2024-12-31.

New apps should use v202309 exclusively and not legacy versions.

Since version v3.1.0 in this SDK, We have isolated the legacy versions API. If you are still using them, please follow below:

```csharp
using SKIT.FlurlHttpClient.ByteDance.TikTokGlobalShop.ExtendedSDK.Legacy;

var options = new TikTokShopLegacyClientOptions()
{
AppKey = "${APP_KEY}",
AppSecret = "${APP_SECRET}}"
};
var client = new TikTokShopLegacyClientBuilder.Create(options).Build();
```

---

### APIs

<details>

<summary>[View Details]</summary>

- Authorization
- Get Access Token: `AuthGetToken`
- Refresh Access Token: `AuthRefreshToken`
- Shop
- Get Authorized Shop: `ShopGetAuthorizedShopList`
- Seller
- Get Active Shop List: `SellerGetGlobalActiveShopList`
- Check Global Product Mode: `SellerCheckGlobalProductMode`
- Product
- Upload File: `ProductUploadFile`
- Upload Image: `ProductUploadImage`
- Create Product: `ProductCreateProduct`
- Delete Product: `ProductDeleteProducts`
- Edit Product: `ProductUpdateProduct`
- Update Stock: `ProductUpdateProductStock`
- Get Product List: `ProductSearchProducts`
- Get Product Detail: `ProductGetProductDetail`
- Get Product Stock: `ProductGetProductStocks`
- Deactivate Product: `ProductDeactivateProducts`
- Activate Product: `ProductActivateProducts`
- Recover Deleted Product: `ProductRecoverProducts`
- Update Price: `ProductUpdateProductPrice`
- Get Categories: `ProductGetCategoryList`
- Get Brands: `ProductGetBrandList`
- Create Brand: `ProductCreateBrand`
- Get Attributes: `ProductGetAttributeList`
- Get Category Rule: `ProductGetCategoryRules`
- Category Recommended: `ProductRecommendCategory`
- Pre-check for Operating Product: `ProductPrecheck`
- Order
- Get Order Detail: `OrderGetOrderDetail`
- Get Order List: `OrderSearchOrders`
- Ship Order: `OrderShipOrder`
- Fulfillment
- Verify Order Split: `FulfillmentVerifyOrderSplit`
- Confirm Order Split: `FulfillmentConfirmOrderSplit`
- Search Pre Combine Package: `FulfillmentSearchPreCombinePackages`
- Get Package Shipping Document: `FulfillmentGetShippingDocument`
- Update Package Shipping Info: `FulfillmentUpdateShippingInfo`
- Get Package Shipping Info: `FulfillmentGetShippingInfo`
- Search Package: `FulfillmentSearchPackages`
- Ship Package: `FulfillmentShipPackage`
- Get Package Pickup Config: `FulfillmentGetPackagePickupConfigList`
- Remove Package Order: `FulfillmentRemovePackageOrders`
- Confirm Precombine Package: `FulfillmentConfirmPreCombinePackage`
- Get Package Detail: `FulfillmentGetPackageDetail`
- Fulfillment Upload Image: `FulfillmentUploadImage`
- Update Package Delivery Status: `FulfillmentUpdatePackageDeliveryStatus`
- Fulfillment Upload File: `FulfillmentUploadFile`
- Batch Ship Packages: `FulfillmentBatchShipPackage`
- Get Shipping Service: `FulfillmentGetShippingService`
- Create Label: `FulfillmentCreateLabel`
- Logistics
- Get Subscribed Delivery Options: `LogisticsGetSubscribedDeliveryOptions`
- Update Shipping Info: `LogisticsUpdateShippingInfo`
- Get Shipping Document: `LogisticsGetShippingDocument`
- Get Shipping Provider: `LogisticsGetShippingProviderList`
- Get Shipping Info: `LogisticsGetShippingInfo`
- Get Warehouse List: `LogisticsGetWarehouseList`
- Reverse
- Reject Reverse Request: `ReverseRejectReverseRequest`
- Get Reverse Order List: `ReverseSearchReverseOrders`
- Confirm Reverse Request: `ReverseConfirmReverseRequest`
- Cancel Order: `ReverseCancelOrder`
- Get Reject Reason List: `ReverseGetRejectReasonList`
- Finance
- Get Settlements: `FinanceSearchSettlements`
- Get Transactions: `FinanceSearchTransactions`
- Get Order Settlements: `FinanceGetOrderSettlementList`
- Global Product
- Create Global Product: `GlobalProductCreateProduct`
- Get Global Product List: `GlobalProductSearchProducts`
- Get Global Product Detail: `GlobalProductGetProductDetail`
- Publish Global Product: `GlobalProductPublishProduct`
- Update Global Product Price: `GlobalProductUpdateProductPrice`
- Get Global Categories: `GlobalProductGetCategoryList`
- Edit Global Product: `GlobalProductUpdateProduct`
- Get Global Attributes: `GlobalProductGetAttributeList`
- Get Global Category Rule: `GlobalProductGetCategoryRules`
- Delete Global Product: `GlobalProductDeleteProducts`
- Promotion
- Update Basic Information: `PromotionUpdateActivity`
- Get Promotion List: `PromotionSearchActivities`
- Deactivate Promotion: `PromotionDeactivateActivity`
- Remove Promotion Item: `PromotionRemoveActivityItems`
- Get Promotion Details: `PromotionGetActivityDetail`
- Add/Update Discount Item: `PromotionAddOrUpdateActivityItems`
- Add Promotion: `PromotionCreateActivity`
- Supply Chain
- Package Fulfillment Data Sync: `SupplyChainSyncPackageFulfillmentData`

</details>
125 changes: 43 additions & 82 deletions docs/TikTokGlobalShop/Basic_ModelDefinition.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,95 +14,56 @@ Naming Policies:

<summary>[View Details]</summary>

- Authorization
- Authentication
- Get Access Token: `AuthGetToken`
- Refresh Access Token: `AuthRefreshToken`
- Shop
- Get Authorized Shop: `ShopGetAuthorizedShopList`
- Authorization
- Get Authorized Shops: `AuthorizationGetShops`
- Event
- Get Shop Webhooks: `EventGetWebhooks`
- Update Shop Webhook: `EventUpdateWebhook`
- Delete Shop Webhook: `EventDeleteWebhook`
- Seller
- Get Active Shop List: `SellerGetGlobalActiveShopList`
- Check Global Product Mode: `SellerCheckGlobalProductMode`
- Product
- Upload File: `ProductUploadFile`
- Upload Image: `ProductUploadImage`
- Get Seller Permissions: `SellerGetPermissions`
- Get Active Shops: `SellerGetShops`
- Products
- Get Brands: `ProductGetBrands`
- Create Custom Brands: `ProductCreateBrand`
- Get Categories: `ProductGetCategories`
- Get Category Rules: `ProductGetCategoryRules`
- Get Attributes: `ProductGetCategoryAttributes`
- Recommend Categories: `ProductRecommendCategories`
- Upload Product Image: `ProductUploadImage`
- Upload Product File: `ProductUploadFile`
- Create Product: `ProductCreateProduct`
- Delete Product: `ProductDeleteProducts`
- Partial Edit Product: `ProductUpdateProductPartial`
- Edit Product: `ProductUpdateProduct`
- Update Stock: `ProductUpdateProductStock`
- Get Product List: `ProductSearchProducts`
- Get Product Detail: `ProductGetProductDetail`
- Get Product Stock: `ProductGetProductStocks`
- Deactivate Product: `ProductDeactivateProducts`
- Activate Product: `ProductActivateProducts`
- Recover Deleted Product: `ProductRecoverProducts`
- Update Inventory: `ProductUpdateProductInventory`
- Update Price: `ProductUpdateProductPrice`
- Get Categories: `ProductGetCategoryList`
- Get Brands: `ProductGetBrandList`
- Create Brand: `ProductCreateBrand`
- Get Attributes: `ProductGetAttributeList`
- Get Category Rule: `ProductGetCategoryRules`
- Category Recommended: `ProductRecommendCategory`
- Pre-check for Operating Product: `ProductPrecheck`
- Order
- Get Order Detail: `OrderGetOrderDetail`
- Activate Products: `ProductActivateProducts`
- Deactivate Products: `ProductDeactivateProducts`
- Delete Products: `ProductDeleteProducts`
- Recover Products: `ProductRecoverProducts`
- Get Product: `ProductGetProductDetail`
- Inventory Search: `ProductGetInventories`
- Get Global Categories: `ProductGetGlobalCategories`
- Get Global Category Rules: `ProductGetGlobalCategoryRules`
- Get Global Attributes: `ProductGetGlobalCategoryAttributes`
- Recommend Global Categories: `ProductRecommendGlobalCategories`
- Create Global Product: `ProductCreateGlobalProduct`
- Publish Global Product: `ProductPublishGlobalProduct`
- Update Global Inventory: `ProductUpdateGlobalProductInventory`
- Get Global Product: `ProductGetGlobalProductDetail`
- Edit Global Product: `ProductUpdateGlobalProduct`
- Delete Global Products: `ProductDeleteGlobalProducts`
- Check Listing Prerequisites: `ProductGetPrerequisites`
- Search Global Products: `ProductSearchGlobalProducts`
- Search Products: `ProductSearchProducts`
- Listing Schemas: `ProductGetListingSchemas`
- Orders
- Get Order List: `OrderSearchOrders`
- Ship Order: `OrderShipOrder`
- Fulfillment
- Verify Order Split: `FulfillmentVerifyOrderSplit`
- Confirm Order Split: `FulfillmentConfirmOrderSplit`
- Search Pre Combine Package: `FulfillmentSearchPreCombinePackages`
- Get Package Shipping Document: `FulfillmentGetShippingDocument`
- Update Package Shipping Info: `FulfillmentUpdateShippingInfo`
- Get Package Shipping Info: `FulfillmentGetShippingInfo`
- Search Package: `FulfillmentSearchPackages`
- Ship Package: `FulfillmentShipPackage`
- Get Package Pickup Config: `FulfillmentGetPackagePickupConfigList`
- Remove Package Order: `FulfillmentRemovePackageOrders`
- Confirm Precombine Package: `FulfillmentConfirmPreCombinePackage`
- Get Package Detail: `FulfillmentGetPackageDetail`
- Fulfillment Upload Image: `FulfillmentUploadImage`
- Update Package Delivery Status: `FulfillmentUpdatePackageDeliveryStatus`
- Fulfillment Upload File: `FulfillmentUploadFile`
- Batch Ship Packages: `FulfillmentBatchShipPackage`
- Get Shipping Service: `FulfillmentGetShippingService`
- Create Label: `FulfillmentCreateLabel`
- Logistics
- Get Subscribed Delivery Options: `LogisticsGetSubscribedDeliveryOptions`
- Update Shipping Info: `LogisticsUpdateShippingInfo`
- Get Shipping Document: `LogisticsGetShippingDocument`
- Get Shipping Provider: `LogisticsGetShippingProviderList`
- Get Shipping Info: `LogisticsGetShippingInfo`
- Get Warehouse List: `LogisticsGetWarehouseList`
- Reverse
- Reject Reverse Request: `ReverseRejectReverseRequest`
- Get Reverse Order List: `ReverseSearchReverseOrders`
- Confirm Reverse Request: `ReverseConfirmReverseRequest`
- Cancel Order: `ReverseCancelOrder`
- Get Reject Reason List: `ReverseGetRejectReasonList`
- Finance
- Get Settlements: `FinanceSearchSettlements`
- Get Transactions: `FinanceSearchTransactions`
- Get Order Settlements: `FinanceGetOrderSettlementList`
- Global Product
- Create Global Product: `GlobalProductCreateProduct`
- Get Global Product List: `GlobalProductSearchProducts`
- Get Global Product Detail: `GlobalProductGetProductDetail`
- Publish Global Product: `GlobalProductPublishProduct`
- Update Global Product Price: `GlobalProductUpdateProductPrice`
- Get Global Categories: `GlobalProductGetCategoryList`
- Edit Global Product: `GlobalProductUpdateProduct`
- Get Global Attributes: `GlobalProductGetAttributeList`
- Get Global Category Rule: `GlobalProductGetCategoryRules`
- Delete Global Product: `GlobalProductDeleteProducts`
- Promotion
- Update Basic Information: `PromotionUpdateActivity`
- Get Promotion List: `PromotionSearchActivities`
- Deactivate Promotion: `PromotionDeactivateActivity`
- Remove Promotion Item: `PromotionRemoveActivityItems`
- Get Promotion Details: `PromotionGetActivityDetail`
- Add/Update Discount Item: `PromotionAddOrUpdateActivityItems`
- Add Promotion: `PromotionCreateActivity`
- Get Order Detail: `OrderBatchGetOrderDetail`
- Supply Chain
- Package Fulfillment Data Sync: `SupplyChainSyncPackageFulfillmentData`
- Confirm Package Shipment: `SupplyChainSyncPackages`

</details>
9 changes: 6 additions & 3 deletions docs/TikTokGlobalShop/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ using SKIT.FlurlHttpClient.ByteDance.TikTokGlobalShop.Models;
/* Example: Get Order List */
var request = new OrderSearchOrdersRequest()
{
ShopId = "${SHOP_ID}"
AccessToken = "${ACCESS_TOKEN}",
ShopCipher = "${SHOP_CIPHER}",
};
var response = await client.ExecuteOrderSearchOrdersAsync(request);
if (response.IsSuccessful())
Expand All @@ -59,8 +60,8 @@ if (response.IsSuccessful())
}
else
{
Console.WriteLine("ErrorCode: " + response.ErrorCode);
Console.WriteLine("ErrorMessage: " + response.ErrorMessage);
Console.WriteLine("Code: " + response.Code);
Console.WriteLine("Message: " + response.Message);
}
```

Expand All @@ -69,3 +70,5 @@ else
## Basic Usage

- [API Reference Manual](./Basic_ModelDefinition.md)

- [Legacy API (pre-v202309)](./Basic_LegacyAPI.md)
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public class SKU
public int? Length { get; set; }

/// <summary>
/// 获取或设置宽度单位
/// 获取或设置宽度
/// </summary>
[Newtonsoft.Json.JsonProperty("width")]
[System.Text.Json.Serialization.JsonPropertyName("width")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class FailedPackage
/// </summary>
[Newtonsoft.Json.JsonProperty("success_package_list")]
[System.Text.Json.Serialization.JsonPropertyName("success_package_list")]
public string[] SucceededPackageList { get; set; } = default!;
public string[] SucceededPackageIdList { get; set; } = default!;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ public IFlurlRequest CreateFlurlRequest(TikTokShopLegacyRequest request, HttpMet
return flurlRequest
.SetQueryParam("app_key", Credentials.AppKey)
.SetQueryParam("access_token", request.AccessToken)
.SetQueryParam("timestamp", request.Timestamp)
.SetQueryParam("shop_id", request.ShopId)
.SetQueryParam("shop_cipher", request.ShopCipher)
.SetQueryParam("timestamp", request.Timestamp)
.SetQueryParam("version", request.ApiVersion);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,25 @@ public abstract class TikTokShopLegacyRequest : CommonRequestBase, ICommonReques
public virtual string? AccessToken { get; set; }

/// <summary>
/// 获取或设置系统时间戳。如果不指定将由系统自动生成
/// 获取或设置店铺 ID
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public virtual long? Timestamp { get; set; }
public virtual string? ShopId { get; set; }

/// <summary>
/// 获取或设置店铺 ID
/// 获取或设置店铺密码
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public virtual string? ShopId { get; set; }
public virtual string? ShopCipher { get; set; }

/// <summary>
/// 获取或设置店铺密码
/// 获取或设置系统时间戳。如果不指定将由系统自动生成
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public virtual string? ShopCipher { get; set; }
public virtual long? Timestamp { get; set; }

/// <summary>
/// 获取或设置 API 版本号。如果不指定将使用系统所支持的最高版本号。
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ public abstract class TikTokShopLegacyResponse : CommonResponseBase, ICommonResp
[Newtonsoft.Json.JsonProperty("code")]
[System.Text.Json.Serialization.JsonPropertyName("code")]
[System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)]
public virtual int ErrorCode { get; set; }
public virtual int Code { get; set; }

/// <summary>
/// 获取 TikTok Shop API 返回的错误信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("message")]
[System.Text.Json.Serialization.JsonPropertyName("message")]
public virtual string? ErrorMessage { get; set; }
public virtual string? Message { get; set; }

/// <summary>
/// 获取 TikTok Shop API 返回的请求唯一标识。
Expand All @@ -33,13 +33,13 @@ public abstract class TikTokShopLegacyResponse : CommonResponseBase, ICommonResp
/// <summary>
/// 获取一个值,该值指示调用 TikTok API 是否成功。
/// <para>
/// (即 HTTP 状态码为 200,且 <see cref="ErrorCode"/> 值为 0)
/// (即 HTTP 状态码为 200,且 <see cref="Code"/> 值为 0)
/// </para>
/// </summary>
/// <returns></returns>
public override bool IsSuccessful()
{
return GetRawStatus() == 200 && ErrorCode == 0;
return GetRawStatus() == 200 && Code == 0;
}
}

Expand Down
Loading
Loading