TencentCloud.Core (tencent_cloud_core v0.1.1) View Source

Common functions for TencentCloud.

Link to this section Summary

Link to this section Functions

Link to this function

common_headers(common, body)

View Source

Specs

common_headers(common :: map(), body :: binary()) :: list()

Gen Common Headers

Examples

iex> TencentCloud.Core.common_headers(
...>   %{
...>     host: "nlp.tencentcloudapi.com",
...>     action: "ChatBot",
...>     version: "2019-04-08",
...>     region: "ap-guangzhou",
...>     date: "2021-09-27",
...>     timestamp: 1632706407,
...>     access_key_id: "GebjUWWJJVnL1en1gtgb52CmNJN8CqdKC0ne",
...>     access_key_secret: "QtXXc6HftX/LEwrSi+MR4OyVEnEslwyg"
...>   },
...>   ~s({"Query":"你好,红领巾,我叫白胡子"})
...> )
[
  {"X-TC-Action", "ChatBot"},
  {"X-TC-Region", "ap-guangzhou"},
  {"X-TC-Timestamp", "1632706407"},
  {"X-TC-Version", "2019-04-08"},
  {"Authorization", "TC3-HMAC-SHA256 Credential=GebjUWWJJVnL1en1gtgb52CmNJN8CqdKC0ne/2021-09-27/nlp/tc3_request, SignedHeaders=content-type;host, Signature=3ec0d092a50635e6bdfcf051750d55dca5bc39e270348d8e46f928d50d3ed833"},
  {"Content-Type", "application/json; charset=utf-8"},
  {"Host", "nlp.tencentcloudapi.com"}
]
Link to this function

sign(host, body, content_type, timestamp, date, service, credential_scope, secret_key)

View Source