Skip to content

TencentCloudApi

Namespace: Vercel.AI.Tencent

public static class TencentCloudApi

Tencent Cloud API 3.0 client with TC3-HMAC-SHA256 signing. Upstream tencent-cloud-api.ts.

Inheritance: object

View source

BuildTc3CanonicalRequest(string, IReadOnlyDictionary<string, string>)

Section titled “BuildTc3CanonicalRequest(string, IReadOnlyDictionary<string, string>)”
public static (string CanonicalRequest, string SignedHeaders) BuildTc3CanonicalRequest(string payload, IReadOnlyDictionary<string, string> headers)

Builds the TC3 canonical request for a POST to / with an empty query. Header names are lowercased and sorted.

Parameters

Name Type Description
payload string
headers IReadOnlyDictionary<string, string>

Returns: (string Opening, string Closing)

View source

CreateTc3Authorization(string, string, string, long, string, IReadOnlyDictionary<string, string>)

Section titled “CreateTc3Authorization(string, string, string, long, string, IReadOnlyDictionary<string, string>)”
public static string CreateTc3Authorization(string secretId, string secretKey, string service, long timestamp, string payload, IReadOnlyDictionary<string, string> headers)

Computes the Authorization header value for a Tencent Cloud API 3.0 request signed with TC3-HMAC-SHA256. <code class=“paramref”>timestamp</code> is a Unix time in seconds and must match the X-TC-Timestamp header.

Parameters

Name Type Description
secretId string
secretKey string
service string
timestamp long
payload string
headers IReadOnlyDictionary<string, string>

Returns: string

View source

public static int GetTencentCloudErrorStatusCode(string code)

Tencent Cloud API 3.0 reports failures with HTTP 200 and a Response.Error code. Maps the code family to the HTTP status it stands for so retry logic sees the real failure class.

Parameters

Name Type Description
code string

Returns: int

View source

public static string Sha256Hex(string value)

Hex SHA-256 of <code class=“paramref”>value</code>.

Parameters

Name Type Description
value string

Returns: string

View source

Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product