ExAliyun.OpenAPI (ex_aliyun_openapi v0.9.0)

View Source

Functions to call Aliyun OpenAPI.

  • You can just put addition args.
  • You can find the api params in Official Link.

Summary

Types

Options that may be passed to a request function. See request/2 for detailed descriptions.

Functions

Aliyun Authenticate Sig Service(人机验证). You can read the doc in Official Link.

Aliyun Project Task Service of CodeUp (云效任务管理). You can read the doc in Official Link.

Aliyun Cloud Push Service(移动推送). You can read the doc in Official Link.

Aliyun Describe Ipv4/6 Location Service(查询IPv4地理位置信息) Please note that when using API to query IP Location Information, you need to open the relevant service in the Product package page first. You can read the doc in Official Link.

Global Aliyun Short Message Service(国际短信服务). You can read the doc in Official Link.

Aliyun Short Message Service(短信服务). You can read the doc in Official Link.

Aliyun Security Token Service(短期访问权限). You can read the doc in Official Link.

Perform a POST request.

Perform a POST request.

Perform request and raise in case of error.

Types

option()

@type option() ::
  {:method, Tesla.Env.method()}
  | {:url, Tesla.Env.url()}
  | {:query, Tesla.Env.query()}
  | {:headers, Tesla.Env.headers()}
  | {:body, Tesla.Env.body()}
  | {:opts, Tesla.Env.opts()}

Options that may be passed to a request function. See request/2 for detailed descriptions.

Functions

call_afs(params, access_info \\ nil)

Aliyun Authenticate Sig Service(人机验证). You can read the doc in Official Link.

call_codeup(params, access_info \\ nil)

Aliyun Project Task Service of CodeUp (云效任务管理). You can read the doc in Official Link.

call_cps(params, access_info \\ nil)

Aliyun Cloud Push Service(移动推送). You can read the doc in Official Link.

call_geoip(params, access_info \\ nil)

Aliyun Describe Ipv4/6 Location Service(查询IPv4地理位置信息) Please note that when using API to query IP Location Information, you need to open the relevant service in the Product package page first. You can read the doc in Official Link.

call_global_sms(params, access_info \\ nil)

Global Aliyun Short Message Service(国际短信服务). You can read the doc in Official Link.

call_sms(params, access_info \\ nil)

Aliyun Short Message Service(短信服务). You can read the doc in Official Link.

call_sts(params, access_info \\ nil)

Aliyun Security Token Service(短期访问权限). You can read the doc in Official Link.

get_access_info(service)

get_timestamp()

post(client, url, body, opts)

Perform a POST request.

See request/1 or request/2 for options definition.

post("/users", %{name: "Jon"})
post("/users", %{name: "Jon"}, query: [scope: "admin"])
post(client, "/users", %{name: "Jon"})
post(client, "/users", %{name: "Jon"}, query: [scope: "admin"])

post!(client, url, body, opts)

Perform a POST request.

See request!/1 or request!/2 for options definition.

post!("/users", %{name: "Jon"})
post!("/users", %{name: "Jon"}, query: [scope: "admin"])
post!(client, "/users", %{name: "Jon"})
post!(client, "/users", %{name: "Jon"}, query: [scope: "admin"])

request(client \\ %Tesla.Client{}, options)

@spec request(Tesla.Env.client(), [option()]) :: Tesla.Env.result()

Perform a request.

Options

  • :method - the request method, one of [:head, :get, :delete, :trace, :options, :post, :put, :patch]
  • :url - either full url e.g. "http://example.com/some/path" or just "/some/path" if using Tesla.Middleware.BaseUrl
  • :query - a keyword list of query params, e.g. [page: 1, per_page: 100]
  • :headers - a keyword list of headers, e.g. [{"content-type", "text/plain"}]
  • :body - depends on used middleware:
    • by default it can be a binary
    • if using e.g. JSON encoding middleware it can be a nested map
    • if adapter supports it it can be a Stream with any of the above
  • :opts - custom, per-request middleware or adapter options

Examples

ExampleApi.request(method: :get, url: "/users/path")

# use shortcut methods
ExampleApi.get("/users/1")
ExampleApi.post(client, "/users", %{name: "Jon"})

request!(client \\ %Tesla.Client{}, options)

@spec request!(Tesla.Env.client(), [option()]) :: Tesla.Env.t() | no_return()

Perform request and raise in case of error.

This is similar to request/2 behaviour from Tesla 0.x

See request/2 for list of available options.