View Source ExOnvif.Request (ExOnvif v0.7.1)

Module describing an onvif request.

Summary

Functions

Add namespaces to the request.

Serializes the request to a string.

Puts a new header in the request.

Types

t()

@type t() :: %ExOnvif.Request{
  content: any(),
  header: ExOnvif.Request.Header.t(),
  namespaces: list()
}

Functions

add_namespaces(request, namespaces)

@spec add_namespaces(t(), list()) :: t()

Add namespaces to the request.

iex> request = %ExOnvif.Request{content: "content"} iex> request = ExOnvif.Request.add_namespaces(request, ["xmlns:wsse": "http://www.w3.org/2003/05/soap-envelope"]) %ExOnvif.Request{content: "content", namespaces: ["xmlns:wsse": "http://www.w3.org/2003/05/soap-envelope"]} iex> ExOnvif.Request.add_namespaces(request, ["xmlns:wsa": "http://www.w3.org/2005/08/addressing"]) %ExOnvif.Request{content: "content", namespaces: ["xmlns:wsa": "http://www.w3.org/2005/08/addressing", "xmlns:wsse": "http://www.w3.org/2003/05/soap-envelope"]}

encode(request)

@spec encode(t()) :: String.t()

Serializes the request to a string.

iex> request = %ExOnvif.Request{content: "content", namespaces: ["xmlns:s": "http://www.w3.org/2003/05/soap-envelope"]} iex> ExOnvif.Request.encode(request) "<s:Envelope xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\">\n content\n</s:Envelope>"

put_header(request, key, value)

@spec put_header(t(), atom(), any()) :: t()

Puts a new header in the request.

iex> request = %ExOnvif.Request{content: "content"} iex> ExOnvif.Request.put_header(request, :subscription_id, "15") %ExOnvif.Request{content: "content", namespaces: [], header: %ExOnvif.Request.Header{subscription_id: "15"}}