Astarte.API.Pairing.Agent (astarte_device v1.1.0)

Astarte Pairing API used by agents. The :auth_token provided when creating the client for this module should be a JWT to access Pairing API.

Link to this section Summary

Functions

Unregisters a device. This makes it possible to register it again, even if it already has requested its credentials. All data belonging to the device will be kept as is.

Link to this section Functions

Link to this function

register_device(client, device_id)

Specs

register_device(client :: Astarte.API.client(), device_id :: String.t()) ::
  Astarte.API.result()

Registers a device.

client is a Pairing API client created with Astarte.API.Pairing.client/3.

device_id is a valid Astarte device id, you can create a random one with :crypto.strong_rand_bytes(16) |> Base.url_encode64(padding: false)

Return values

  • {:ok, result} if the HTTP request can be performed. result will be a map with status, headers and body.
  • {:error, reason} if the HTTP request can't be performed.
Link to this function

unregister_device(client, device_id)

Specs

unregister_device(client :: Astarte.API.client(), device_id :: String.t()) ::
  Astarte.API.result()

Unregisters a device. This makes it possible to register it again, even if it already has requested its credentials. All data belonging to the device will be kept as is.

client is a Pairing API client created with Astarte.API.Pairing.client/3.

device_id is the device id of a registered Astarte device.## Return values *if the HTTP request can be performed.resultwill be a map withstatus,headersandbody. *` if the HTTP request can't be performed.