-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add docs #20
base: master
Are you sure you want to change the base?
Add docs #20
Conversation
Signed-off-by: Sergey Zakhlypa <[email protected]>
Signed-off-by: Sergey Zakhlypa <[email protected]>
Signed-off-by: Sergey Zakhlypa <[email protected]>
Signed-off-by: Sergey Zakhlypa <[email protected]>
Signed-off-by: Sergey Zakhlypa <[email protected]>
Signed-off-by: Sergey Zakhlypa <[email protected]>
Signed-off-by: Sergey Zakhlypa <[email protected]>
Signed-off-by: Sergey Zakhlypa <[email protected]>
Signed-off-by: Sergey Zakhlypa <[email protected]>
Signed-off-by: Sergey Zakhlypa <[email protected]>
Signed-off-by: Sergey Zakhlypa <[email protected]>
Signed-off-by: Sergey Zakhlypa <[email protected]>
Signed-off-by: Sergey Zakhlypa <[email protected]>
Signed-off-by: Sergey Zakhlypa <[email protected]>
Signed-off-by: Sergey Zakhlypa <[email protected]>
Signed-off-by: Sergey Zakhlypa <[email protected]>
Signed-off-by: Sergey Zakhlypa <[email protected]>
Pull Request Test Coverage Report for Build 9c514c8f0bb208de207b0792d7f8162eb9527c96-PR-20
💛 - Coveralls |
@moduledoc """ | ||
Documentation for `Astarte.Client`. | ||
""" | ||
@moduledoc false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's plan to remove this module in a following MR since it's currently useless
This struct is designed to provide information needed to effectively log and maybe respond | ||
to an error. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-> This struct is designed to provide relevant information about the error.
@moduledoc """ | ||
Module to configure communication with Astarte AppEngine API. | ||
|
||
Most applications would want to use AppEngine to interact with devices, stream and receive data, and oversee their fleet. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oversee their fleet -> interact with the fleet
alias __MODULE__ | ||
alias Astarte.Client.Credentials | ||
@doc """ | ||
Returns configured `Astarte.Client.AppEngine` struct. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-> a configured
|
||
@jwt_expiry 5 * 60 | ||
This function receives Astarte base API URL and name of the realm alongside authentication options |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
receives the Astarte [...] and the name of [...]
@doc """ | ||
Unset a value on a given endpoint path, path is also deleted. | ||
|
||
Interface should be an individual server owned property interface and to support unset. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[...] interface that supports unsets.
It must be a ISO 8601 valid timestamp. | ||
This option is mutually exclusive with `:since`. | ||
|
||
* `:to` - query all values up to a certain timestamp. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
up to and including/excluding (not sure what is the actual behaviour tbh)
|
||
* `:to` - query all values up to a certain timestamp. | ||
It must be a ISO 8601 valid timestamp. | ||
If `:since` and `:since_after` are not specified first entry date is assumed by default. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if we need this line
It must be a ISO 8601 valid timestamp. | ||
If `:since` and `:since_after` are not specified first entry date is assumed by default. | ||
|
||
* `:limit` - limit number of retrieved data production entries to `:limit`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
limit the number [...]
|
||
* `:query` - list of query params | ||
|
||
## Query options |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In all the examples, don't use the atom when using it as value, i.e. remove the :
in front.
For example:
query all values since a certain timestamp (all entries where timestamp >= :since
becomes
query all values since a certain timestamp (all entries where timestamp >= since
And so on for all the others
|
||
One of `:jwt` and `:private_key` options is required. | ||
|
||
* `:jwt` - JWT for Bearer authentication, if used `:private_key` and `:jwt_opts` are ignored |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JWT for Bearer authentication ; if used, :private_key
and :jwt_opts
are ignored
|
||
* `:jwt` - JWT for Bearer authentication, if used `:private_key` and `:jwt_opts` are ignored | ||
|
||
* `:private_key` - will be used to generate JWT, this option is mutually exclusive |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private_key` - will be used to generate JWT ; this option is mutually exclusive
* `:jwt` - JWT for Bearer authentication, if used `:private_key` and `:jwt_opts` are ignored | ||
|
||
* `:private_key` - will be used to generate JWT, this option is mutually exclusive | ||
with `:jwt`, if the latter is used, this option will be ignored. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with :jwt
. If the latter is used, this option will be ignored.
* `:private_key` - will be used to generate JWT, this option is mutually exclusive | ||
with `:jwt`, if the latter is used, this option will be ignored. | ||
|
||
* `:jwt_opts` - will add additional JWT claims to generated JWT, this option is mutually exclusive |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will add additional JWT claims to the generated JWT ; this option is mutually exclusive
with `:jwt`, if the latter is used, this option will be ignored. | ||
|
||
* `:jwt_opts` - will add additional JWT claims to generated JWT, this option is mutually exclusive | ||
with `:jwt`, if the latter is used, this option will be ignored. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with :jwt
. If the latter is used, this option will be ignored.
Returns a list of interfaces supported by a certain device. | ||
|
||
Interfaces that are not reported by the device are not reported here. | ||
If a device stops to advertise a certain interface, it should be retrived from a different API, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If a device stops to advertise a certain interface, it should be retrived from a different API .
|
||
Interfaces that are not reported by the device are not reported here. | ||
If a device stops to advertise a certain interface, it should be retrived from a different API, | ||
same applies for older versions of a certain interface. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same applies for older versions of a certain interface.
@@ -57,6 +103,18 @@ defmodule Astarte.Client.AppEngine.Devices do | |||
end | |||
end | |||
|
|||
@doc """ | |||
Returns a values snapshot for a given interface without `:path` option, otherwise |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Returns a value s snapshot for a given interface without :path
option, otherwise
or
Returns a snapshot of values for a given interface without :path
option, otherwise
@doc """ | ||
Update a property value on a given endpoint path. | ||
|
||
Interface should be an individual server owned property interface. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The interface should be an individual server owned property interface.
@@ -106,6 +176,36 @@ defmodule Astarte.Client.AppEngine.Devices do | |||
end | |||
end | |||
|
|||
@doc """ | |||
Returns values for a given datastream interface. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It returns values for a given datastream interface.
|
||
* `:to` - query all values up to a certain timestamp. | ||
It must be a ISO 8601 valid timestamp. | ||
If `:since` and `:since_after` are not specified first entry date is assumed by default. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[...] , the specified first entry date is assumed by default.
def append_housekeeping_claim(%Credentials{} = credentials, claim) when is_binary(claim) do | ||
append_claim(credentials, "a_ha", claim) | ||
end | ||
|
||
@doc """ | ||
Appends claim for Realm Management API |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It appends a claim
or
It appends claims
def append_realm_management_claim(%Credentials{} = credentials, claim) when is_binary(claim) do | ||
append_claim(credentials, "a_rma", claim) | ||
end | ||
|
||
@doc """ | ||
Appends claim for Pairing API |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It appends a claim
or
It appends claims
def append_pairing_claim(%Credentials{} = credentials, claim) when is_binary(claim) do | ||
append_claim(credentials, "a_pa", claim) | ||
end | ||
|
||
@doc """ | ||
Appends claim for AppEngine API |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It appends a claim
or
It appends claims
def append_appengine_claim(%Credentials{} = credentials, claim) when is_binary(claim) do | ||
append_claim(credentials, "a_aea", claim) | ||
end | ||
|
||
@doc """ | ||
Appends claim for Astarte Channels |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It appends a claim
or
It appends claims
def append_channels_claim(%Credentials{} = credentials, claim) when is_binary(claim) do | ||
append_claim(credentials, "a_ch", claim) | ||
end | ||
|
||
@doc """ | ||
Appends claim for Flow API |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It appends a claim
or
It appends claims
@@ -144,6 +293,17 @@ defmodule Astarte.Client.Credentials do | |||
%{credentials | claims: updated_claims} | |||
end | |||
|
|||
@doc """ | |||
Sets expiry used to generate expiration time claim. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It sets an expiry used to generate an/the expiration time claim.
|
||
@jwt_expiry 5 * 60 | ||
This function receives Astarte base API URL alongside authentication options | ||
and returns configured `Astarte.Client.Housekeeping` struct. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and returns a configured [...]
|
||
@jwt_expiry 5 * 60 | ||
This function receives Astarte base API URL alongside authentication options |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function receives the Astarte base API URL [...]
Housekeeping is the equivalent of a superadmin API. | ||
It allows to manage and create realms, perform cluster-wide maintenance actions. | ||
This API is usually accessible only to system administrators, and is not meant for the average user of Astarte, | ||
which should refer to `Astarte.Client.RealmManagement` instead. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
who should refer [...]
This function receives Astarte base API URL alongside authentication options | ||
and returns configured `Astarte.Client.Housekeeping` struct. | ||
|
||
## Options |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rework punctuation in this section as per above comments.
|
||
* `:datacenter_replication_factors` - uses `NetworkTopologyStrategy` replication strategy | ||
and allows to define the number of replicas for each data center. | ||
This option is mutually exclusive with `:replication_factor`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[...] with :replication_factor
;
|
||
* `:replication_factor` - uses `SimpleStrategy` replication strategy | ||
and allows to define the number of replicas for a single datacenter. | ||
This option is mutually exclusive with `:datacenter_replication_factors`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[see above]
@enforce_keys [:http_client] | ||
defstruct @enforce_keys | ||
|
||
@type t :: %__MODULE__{ | ||
http_client: Tesla.Client.t() | ||
} | ||
|
||
alias Astarte.Client.Credentials | ||
@doc """ | ||
Returns configured `Astarte.Client.Pairing` struct. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Returns a configured [...]
@@ -110,6 +147,10 @@ defmodule Astarte.Client.Housekeeping.Realms do | |||
end | |||
end | |||
|
|||
@doc """ | |||
Returns a realm's configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Capitalise Realm (e.g. https://docs.astarte-platform.org/latest/020-components.html#realm-management)
|
||
@jwt_expiry 5 * 60 | ||
This function receives Astarte base API URL and name of the realm alongside authentication options |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
receives the Astarte [...] and the name of the Realm
|
||
@jwt_expiry 5 * 60 | ||
This function receives Astarte base API URL and name of the realm alongside authentication options | ||
and returns configured `Astarte.Client.Pairing` struct. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and returns a configured [...]
This function receives Astarte base API URL and name of the realm alongside authentication options | ||
and returns configured `Astarte.Client.Pairing` struct. | ||
|
||
## Options |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rework punctuation in this section as per above comments.
@doc """ | ||
Register a device, obtaining its credentials secret. | ||
|
||
The registration can be repeated as long as the device didn't request any credentials. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would avoid contractions.
[...] the device did not request [...]
@doc """ | ||
Unregister a device. | ||
|
||
This makes it possible to register it again, even if it already has requested its credentials. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This allows registering the device again, even if it has already requested its credentials.
alias __MODULE__ | ||
alias Astarte.Client.Credentials | ||
@doc """ | ||
Returns configured `Astarte.Client.RealmManagement` struct. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Returns a configured [...]
|
||
@jwt_expiry 5 * 60 | ||
This function receives Astarte base API URL and name of the realm alongside authentication options |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
receives the Astarte [...] and the name of the Realm
|
||
@jwt_expiry 5 * 60 | ||
This function receives Astarte base API URL and name of the realm alongside authentication options | ||
and returns configured `Astarte.Client.RealmManagement` struct. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and returns a configured [...]
This function receives Astarte base API URL and name of the realm alongside authentication options | ||
and returns configured `Astarte.Client.RealmManagement` struct. | ||
|
||
## Options |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rework punctuation in this section as per above comments.
@@ -32,6 +48,15 @@ defmodule Astarte.Client.RealmManagement.Interfaces do | |||
end | |||
end | |||
|
|||
@doc """ | |||
Returns the list of all major versions for given interface. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[...] for a given interface.
Update an existing interface. | ||
|
||
Replaces an existing interface with a given major version with a new one | ||
(that must have same major version and a higher minor version). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(that must have the same major version [...]
alias Astarte.Client.{APIError, RealmManagement} | ||
|
||
@doc """ | ||
Returns the auth configuration of the realm. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Capitalise Realm.
@@ -32,6 +41,10 @@ defmodule Astarte.Client.RealmManagement.RealmConfig do | |||
end | |||
end | |||
|
|||
@doc """ | |||
Installs an auth configuration for the realm. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Capitalise Realm.
alias Astarte.Client.{APIError, RealmManagement} | ||
|
||
@doc """ | ||
Returns the list of all installed triggers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all the installed triggers.
@doc """ | ||
Create a new trigger using provided configuration. | ||
|
||
Trigger validation is performed before installation, if trigger configuration is not valid or |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trigger validation is performed before installation ; if trigger
Create a new trigger using provided configuration. | ||
|
||
Trigger validation is performed before installation, if trigger configuration is not valid or | ||
a trigger with the same name already exists an error is reported. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a trigger with the same name already exists , an error is reported.
No description provided.