-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
606 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
99 changes: 99 additions & 0 deletions
99
...lient.ByteDance.TikTokGlobalShop/Extensions/TikTokShopClientExecuteLogisticsExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
using System; | ||
using System.Net.Http; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using Flurl.Http; | ||
|
||
namespace SKIT.FlurlHttpClient.ByteDance.TikTokGlobalShop | ||
{ | ||
public static class TikTokShopClientExecuteLogisticsExtensions | ||
{ | ||
/// <summary> | ||
/// <para>异步调用 [GET] /logistics/{version}/warehouses 接口。</para> | ||
/// <para> | ||
/// REF: <br/> | ||
/// <![CDATA[ https://partner.tiktokshop.com/docv2/page/650aa418defece02be6e66b6 ]]> | ||
/// </para> | ||
/// </summary> | ||
/// <param name="client"></param> | ||
/// <param name="request"></param> | ||
/// <param name="cancellationToken"></param> | ||
/// <returns></returns> | ||
public static async Task<Models.LogisticsGetWarehousesResponse> ExecuteLogisticsGetWarehousesAsync(this TikTokShopClient client, Models.LogisticsGetWarehousesRequest request, CancellationToken cancellationToken = default) | ||
{ | ||
if (client is null) throw new ArgumentNullException(nameof(client)); | ||
if (request is null) throw new ArgumentNullException(nameof(request)); | ||
|
||
IFlurlRequest flurlReq = client | ||
.CreateFlurlRequest(request, HttpMethod.Get, "logistics", request.ApiVersion, "warehouses"); | ||
|
||
return await client.SendFlurlRequesAsJsontAsync<Models.LogisticsGetWarehousesResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false); | ||
} | ||
|
||
/// <summary> | ||
/// <para>异步调用 [GET] /logistics/{version}/global_warehouses 接口。</para> | ||
/// <para> | ||
/// REF: <br/> | ||
/// <![CDATA[ https://partner.tiktokshop.com/docv2/page/650aa3f0defece02be6e5ffb ]]> | ||
/// </para> | ||
/// </summary> | ||
/// <param name="client"></param> | ||
/// <param name="request"></param> | ||
/// <param name="cancellationToken"></param> | ||
/// <returns></returns> | ||
public static async Task<Models.LogisticsGetGlobalWarehousesResponse> ExecuteLogisticsGetGlobalWarehousesAsync(this TikTokShopClient client, Models.LogisticsGetGlobalWarehousesRequest request, CancellationToken cancellationToken = default) | ||
{ | ||
if (client is null) throw new ArgumentNullException(nameof(client)); | ||
if (request is null) throw new ArgumentNullException(nameof(request)); | ||
|
||
IFlurlRequest flurlReq = client | ||
.CreateFlurlRequest(request, HttpMethod.Get, "logistics", request.ApiVersion, "global_warehouses"); | ||
|
||
return await client.SendFlurlRequesAsJsontAsync<Models.LogisticsGetGlobalWarehousesResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false); | ||
} | ||
|
||
/// <summary> | ||
/// <para>异步调用 [GET] /logistics/{version}/warehouses/{warehouse_id}/delivery_options 接口。</para> | ||
/// <para> | ||
/// REF: <br/> | ||
/// <![CDATA[ https://partner.tiktokshop.com/docv2/page/650aa46ebace3e02b75d9afa ]]> | ||
/// </para> | ||
/// </summary> | ||
/// <param name="client"></param> | ||
/// <param name="request"></param> | ||
/// <param name="cancellationToken"></param> | ||
/// <returns></returns> | ||
public static async Task<Models.LogisticsGetWarehouseDeliveryOptionsResponse> ExecuteLogisticsGetWarehouseDeliveryOptionsAsync(this TikTokShopClient client, Models.LogisticsGetWarehouseDeliveryOptionsRequest request, CancellationToken cancellationToken = default) | ||
{ | ||
if (client is null) throw new ArgumentNullException(nameof(client)); | ||
if (request is null) throw new ArgumentNullException(nameof(request)); | ||
|
||
IFlurlRequest flurlReq = client | ||
.CreateFlurlRequest(request, HttpMethod.Get, "logistics", request.ApiVersion, "warehouses", request.WarehouseId, "delivery_options"); | ||
|
||
return await client.SendFlurlRequesAsJsontAsync<Models.LogisticsGetWarehouseDeliveryOptionsResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false); | ||
} | ||
|
||
/// <summary> | ||
/// <para>异步调用 [GET] /logistics/{version}/delivery_options/{delivery_option_id}/shipping_providers 接口。</para> | ||
/// <para> | ||
/// REF: <br/> | ||
/// <![CDATA[ https://partner.tiktokshop.com/docv2/page/650aa48d4a0bb702c06d85cd ]]> | ||
/// </para> | ||
/// </summary> | ||
/// <param name="client"></param> | ||
/// <param name="request"></param> | ||
/// <param name="cancellationToken"></param> | ||
/// <returns></returns> | ||
public static async Task<Models.LogisticsGetDeliveryOptionShippingProvidersResponse> ExecuteLogisticsGetDeliveryOptionShippingProvidersAsync(this TikTokShopClient client, Models.LogisticsGetDeliveryOptionShippingProvidersRequest request, CancellationToken cancellationToken = default) | ||
{ | ||
if (client is null) throw new ArgumentNullException(nameof(client)); | ||
if (request is null) throw new ArgumentNullException(nameof(request)); | ||
|
||
IFlurlRequest flurlReq = client | ||
.CreateFlurlRequest(request, HttpMethod.Get, "logistics", request.ApiVersion, "delivery_options", request.DeliveryOptionId, "shipping_providers"); | ||
|
||
return await client.SendFlurlRequesAsJsontAsync<Models.LogisticsGetDeliveryOptionShippingProvidersResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false); | ||
} | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
...e.TikTokGlobalShop/Models/Logistics/LogisticsGetDeliveryOptionShippingProvidersRequest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
namespace SKIT.FlurlHttpClient.ByteDance.TikTokGlobalShop.Models | ||
{ | ||
/// <summary> | ||
/// <para>表示 [GET] /logistics/{version}/delivery_options/{delivery_option_id}/shipping_providers 接口的请求。</para> | ||
/// </summary> | ||
public class LogisticsGetDeliveryOptionShippingProvidersRequest : TikTokShopRequest | ||
{ | ||
/// <summary> | ||
/// 获取或设置配送方式 ID。 | ||
/// </summary> | ||
[Newtonsoft.Json.JsonIgnore] | ||
[System.Text.Json.Serialization.JsonIgnore] | ||
public string DeliveryOptionId { get; set; } = string.Empty; | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
....TikTokGlobalShop/Models/Logistics/LogisticsGetDeliveryOptionShippingProvidersResponse.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
namespace SKIT.FlurlHttpClient.ByteDance.TikTokGlobalShop.Models | ||
{ | ||
/// <summary> | ||
/// <para>表示 [GET] /logistics/{version}/delivery_options/{delivery_option_id}/shipping_providers 接口的响应。</para> | ||
/// </summary> | ||
public class LogisticsGetDeliveryOptionShippingProvidersResponse : TikTokShopResponse<LogisticsGetDeliveryOptionShippingProvidersResponse.Types.Data> | ||
{ | ||
public static class Types | ||
{ | ||
public class Data | ||
{ | ||
public static class Types | ||
{ | ||
public class ShippingProvider | ||
{ | ||
/// <summary> | ||
/// 获取或设置运输服务商 ID。 | ||
/// </summary> | ||
[Newtonsoft.Json.JsonProperty("id")] | ||
[System.Text.Json.Serialization.JsonPropertyName("id")] | ||
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.Common.NumericalStringReadOnlyConverter))] | ||
public string ShippingProviderId { get; set; } = default!; | ||
|
||
/// <summary> | ||
/// 获取或设置运输服务商名称。 | ||
/// </summary> | ||
[Newtonsoft.Json.JsonProperty("name")] | ||
[System.Text.Json.Serialization.JsonPropertyName("name")] | ||
public string Name { get; set; } = default!; | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// 获取或设置运输服务商列表。 | ||
/// </summary> | ||
[Newtonsoft.Json.JsonProperty("shipping_providers")] | ||
[System.Text.Json.Serialization.JsonPropertyName("shipping_providers")] | ||
public Types.ShippingProvider[] ShippingProviderList { get; set; } = default!; | ||
} | ||
} | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
...Client.ByteDance.TikTokGlobalShop/Models/Logistics/LogisticsGetGlobalWarehousesRequest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace SKIT.FlurlHttpClient.ByteDance.TikTokGlobalShop.Models | ||
{ | ||
/// <summary> | ||
/// <para>表示 [GET] /logistics/{version}/global_warehouses 接口的请求。</para> | ||
/// </summary> | ||
public class LogisticsGetGlobalWarehousesRequest : TikTokShopRequest | ||
{ | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
...lient.ByteDance.TikTokGlobalShop/Models/Logistics/LogisticsGetGlobalWarehousesResponse.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
namespace SKIT.FlurlHttpClient.ByteDance.TikTokGlobalShop.Models | ||
{ | ||
/// <summary> | ||
/// <para>表示 [GET] /logistics/{version}/global_warehouses 接口的响应。</para> | ||
/// </summary> | ||
public class LogisticsGetGlobalWarehousesResponse : TikTokShopResponse<LogisticsGetGlobalWarehousesResponse.Types.Data> | ||
{ | ||
public static class Types | ||
{ | ||
public class Data | ||
{ | ||
public static class Types | ||
{ | ||
public class Warehouse | ||
{ | ||
/// <summary> | ||
/// 获取或设置仓库 ID。 | ||
/// </summary> | ||
[Newtonsoft.Json.JsonProperty("id")] | ||
[System.Text.Json.Serialization.JsonPropertyName("id")] | ||
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.Common.NumericalStringReadOnlyConverter))] | ||
public string WarehouseId { get; set; } = default!; | ||
|
||
/// <summary> | ||
/// 获取或设置仓库名称。 | ||
/// </summary> | ||
[Newtonsoft.Json.JsonProperty("name")] | ||
[System.Text.Json.Serialization.JsonPropertyName("name")] | ||
public string Name { get; set; } = default!; | ||
|
||
/// <summary> | ||
/// 获取或设置所有权类型。 | ||
/// </summary> | ||
[Newtonsoft.Json.JsonProperty("ownership")] | ||
[System.Text.Json.Serialization.JsonPropertyName("ownership")] | ||
public string Ownership { get; set; } = default!; | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// 获取或设置仓库列表。 | ||
/// </summary> | ||
[Newtonsoft.Json.JsonProperty("global_warehouses")] | ||
[System.Text.Json.Serialization.JsonPropertyName("global_warehouses")] | ||
public Types.Warehouse[] WarehouseList { get; set; } = default!; | ||
} | ||
} | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
...yteDance.TikTokGlobalShop/Models/Logistics/LogisticsGetWarehouseDeliveryOptionsRequest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
namespace SKIT.FlurlHttpClient.ByteDance.TikTokGlobalShop.Models | ||
{ | ||
/// <summary> | ||
/// <para>表示 [GET] /logistics/{version}/warehouses/{warehouse_id}/delivery_options 接口的请求。</para> | ||
/// </summary> | ||
public class LogisticsGetWarehouseDeliveryOptionsRequest : TikTokShopRequest | ||
{ | ||
/// <summary> | ||
/// 获取或设置仓库 ID。 | ||
/// </summary> | ||
[Newtonsoft.Json.JsonIgnore] | ||
[System.Text.Json.Serialization.JsonIgnore] | ||
public string WarehouseId { get; set; } = string.Empty; | ||
} | ||
} |
128 changes: 128 additions & 0 deletions
128
...teDance.TikTokGlobalShop/Models/Logistics/LogisticsGetWarehouseDeliveryOptionsResponse.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
namespace SKIT.FlurlHttpClient.ByteDance.TikTokGlobalShop.Models | ||
{ | ||
/// <summary> | ||
/// <para>表示 [GET] /logistics/{version}/warehouses/{warehouse_id}/delivery_options 接口的响应。</para> | ||
/// </summary> | ||
public class LogisticsGetWarehouseDeliveryOptionsResponse : TikTokShopResponse<LogisticsGetWarehouseDeliveryOptionsResponse.Types.Data> | ||
{ | ||
public static class Types | ||
{ | ||
public class Data | ||
{ | ||
public static class Types | ||
{ | ||
public class DeliveryOption | ||
{ | ||
public static class Types | ||
{ | ||
public class DimensionLimit | ||
{ | ||
/// <summary> | ||
/// 获取或设置最大长度。 | ||
/// </summary> | ||
[Newtonsoft.Json.JsonProperty("max_length")] | ||
[System.Text.Json.Serialization.JsonPropertyName("max_length")] | ||
public int MaxLength { get; set; } | ||
|
||
/// <summary> | ||
/// 获取或设置最大宽度。 | ||
/// </summary> | ||
[Newtonsoft.Json.JsonProperty("max_width")] | ||
[System.Text.Json.Serialization.JsonPropertyName("max_width")] | ||
public int MaxWidth { get; set; } | ||
|
||
/// <summary> | ||
/// 获取或设置最大高度。 | ||
/// </summary> | ||
[Newtonsoft.Json.JsonProperty("max_height")] | ||
[System.Text.Json.Serialization.JsonPropertyName("max_height")] | ||
public int MaxHeight { get; set; } | ||
|
||
/// <summary> | ||
/// 获取或设置尺寸单位。 | ||
/// </summary> | ||
[Newtonsoft.Json.JsonProperty("unit")] | ||
[System.Text.Json.Serialization.JsonPropertyName("unit")] | ||
public string Unit { get; set; } = default!; | ||
} | ||
|
||
public class WeightLimit | ||
{ | ||
/// <summary> | ||
/// 获取或设置最小重量。 | ||
/// </summary> | ||
[Newtonsoft.Json.JsonProperty("min_weight")] | ||
[System.Text.Json.Serialization.JsonPropertyName("min_weight")] | ||
public int MinWeight { get; set; } | ||
|
||
/// <summary> | ||
/// 获取或设置最大重量。 | ||
/// </summary> | ||
[Newtonsoft.Json.JsonProperty("max_weight")] | ||
[System.Text.Json.Serialization.JsonPropertyName("max_weight")] | ||
public int MaxWeight { get; set; } | ||
|
||
/// <summary> | ||
/// 获取或设置重量单位。 | ||
/// </summary> | ||
[Newtonsoft.Json.JsonProperty("unit")] | ||
[System.Text.Json.Serialization.JsonPropertyName("unit")] | ||
public string Unit { get; set; } = default!; | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// 获取或设置配送方式 ID。 | ||
/// </summary> | ||
[Newtonsoft.Json.JsonProperty("id")] | ||
[System.Text.Json.Serialization.JsonPropertyName("id")] | ||
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.Common.NumericalStringReadOnlyConverter))] | ||
public string DeliveryOptionId { get; set; } = default!; | ||
|
||
/// <summary> | ||
/// 获取或设置配送方式名称。 | ||
/// </summary> | ||
[Newtonsoft.Json.JsonProperty("name")] | ||
[System.Text.Json.Serialization.JsonPropertyName("name")] | ||
public string Name { get; set; } = default!; | ||
|
||
/// <summary> | ||
/// 获取或设置类型。 | ||
/// </summary> | ||
[Newtonsoft.Json.JsonProperty("type")] | ||
[System.Text.Json.Serialization.JsonPropertyName("type")] | ||
public string Type { get; set; } = default!; | ||
|
||
/// <summary> | ||
/// 获取或设置描述。 | ||
/// </summary> | ||
[Newtonsoft.Json.JsonProperty("description")] | ||
[System.Text.Json.Serialization.JsonPropertyName("description")] | ||
public string Description { get; set; } = default!; | ||
|
||
/// <summary> | ||
/// 获取或设置尺寸限制。 | ||
/// </summary> | ||
[Newtonsoft.Json.JsonProperty("dimension_limit")] | ||
[System.Text.Json.Serialization.JsonPropertyName("dimension_limit")] | ||
public Types.DimensionLimit DimensionLimit { get; set; } = default!; | ||
|
||
/// <summary> | ||
/// 获取或设置重量限制。 | ||
/// </summary> | ||
[Newtonsoft.Json.JsonProperty("weight_limit")] | ||
[System.Text.Json.Serialization.JsonPropertyName("weight_limit")] | ||
public Types.WeightLimit WeightLimit { get; set; } = default!; | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// 获取或设置配送方式列表。 | ||
/// </summary> | ||
[Newtonsoft.Json.JsonProperty("delivery_options")] | ||
[System.Text.Json.Serialization.JsonPropertyName("delivery_options")] | ||
public Types.DeliveryOption[] DeliveryOptionList { get; set; } = default!; | ||
} | ||
} | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
...rlHttpClient.ByteDance.TikTokGlobalShop/Models/Logistics/LogisticsGetWarehousesRequest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace SKIT.FlurlHttpClient.ByteDance.TikTokGlobalShop.Models | ||
{ | ||
/// <summary> | ||
/// <para>表示 [GET] /logistics/{version}/warehouses 接口的请求。</para> | ||
/// </summary> | ||
public class LogisticsGetWarehousesRequest : TikTokShopRequest | ||
{ | ||
} | ||
} |
Oops, something went wrong.