Callback_2: Optional completion of each data request of each notification with info from the Device Default impl: (keep as is)
Callback_2: Optional completion of each data request of each notification with info from the Device Default impl: (keep as is)
Good(req)
Override this method if you want to display a message after the subscription phase.
Override this method if you want to display a message after the subscription phase. You can use this method to list devices and let the user knows some devices will be created. Default impl: No welcome message is displayed
Good(NoWelcomePage)
the Context of execution
the DeviceInfo of the target device
the RequestDef that produce the res (None if no res is None)
the Response produced by the RequestDef returns by a previous call to generateWelcomePage
Override this method if CloudConnector require to do some requests to complete the setup of the CloudConnector on the third party (the method is called at least once after approbation/activation) (e.g.
Override this method if CloudConnector require to do some requests to complete the setup of the CloudConnector on the third party (the method is called at least once after approbation/activation) (e.g. to register/validate a notification url)
Default impl:
Good(Empty.list())
an list of Request that will be called in order to complete setup on third party.
Sometimes the third-party cloud doesn't follow the OAuth2 RFC This method allow to "normalize" the incoming request with OAuth2 code.
Sometimes the third-party cloud doesn't follow the OAuth2 RFC This method allow to "normalize" the incoming request with OAuth2 code.
Default impl: (keep as is)
Good(req)
the Context for the current Cloud Connector
the http request received by the server from the client with the oauth2's code, the request to normalize
a RequestDef with the oauth2's code as query parameter
Sometimes the third-party cloud doesn't follow the OAuth2 RFC This method allow to "normalize" the response to the request for accessToken (phase == getOauth2Token) or to the request to refreshToken (phase == refreshToken).
Sometimes the third-party cloud doesn't follow the OAuth2 RFC This method allow to "normalize" the response to the request for accessToken (phase == getOauth2Token) or to the request to refreshToken (phase == refreshToken). (this function is called before applying the mapping define in accessTokenUrlMapper if it is defined)
Default impl: (keep as is)
Good(resp)
the Context for the current Cloud Connector
the http response from the 3rd party cloud to the access token request (first time or refresh), the request to normalize
the Phase where the response is read (getOauth2Token or refreshToken)
a Response with the oauth2's parameter normalized
Callback_5: Called for each action received.
Callback_5: Called for each action received. The request targets 1 device. Optionally build data request with info from the Device. Fetch function will be called with the RequestDef included in. Default impl:
Bad(Failure("unsupported: method onAction should be implemented"))
Callback_6: Called for each pushed data generated by onAction
Override this method if your CloudConnector authentication type is CUSTOM_AUTH.
Override this method if your CloudConnector authentication type is CUSTOM_AUTH. Default impl:
Bad(Failure("unsupported: method onCustomAuthentication should be implemented"))
Callback_3: Parse Response from req to extract, filter, transform data for the device (only response with http status 200 - 299, other status are managed by CloudConnector Container) Default impl:
Callback_3: Parse Response from req to extract, filter, transform data for the device (only response with http status 200 - 299, other status are managed by CloudConnector Container) Default impl:
Bad(Failure("unsupported : method onFetchResponse should be implemented"))
to process the response of the request send on initialize.
to process the response of the request send on initialize.
Default impl:
Good(Empty.map())
ignored (TODAY)
Callback_1: Ask CloudConnector to parse the notification request from third party cloud to extract all notifications.
Callback_1: Ask CloudConnector to parse the notification request from third party cloud to extract all notifications. The request can target 0+ devices and can notify about 1+ data feed. Default impl:
Bad(Failure("unsupported : method onNotification should be implemented"))
Failure("unsupported : method onNotification should be implemented")
Callback_4: Parse and check (authorisation) pushed data (data come from Notification and can be transformed) Default impl:
Callback_4: Parse and check (authorisation) pushed data (data come from Notification and can be transformed) Default impl:
Bad(Failure("unsupported: method onNotificationData should be implemented"))
Procress the response of the request defined by subscribe(...).
Procress the response of the request defined by subscribe(...). The subscription can store/update the deviceInfo. Default impl:
Good(None)
an updated DeviceInfo (or None / Option.apply(null) if nothing to store)
Procress the response of the request defined by unsubscribe(...).
Procress the response of the request defined by unsubscribe(...). Default impl:
Good(None)
an updated DeviceInfo (or None / Option.apply(null) if nothing to store)
This will be call automatically on every API request to the 3rd party cloud.
This will be call automatically on every API request to the 3rd party cloud. You can use this method to complete request with authorisation data, ...
Default impl: (keep as is)
Good(req)
This method is also the only way to customize request to refresh token.
if (phase == Phase.refreshToken) {
...
}
Override this method if CloudConnector require to do some request to complete the subscription after authentication (eg: to retreive user's timezone use in notification, to request subscriptionId on 3rd party cloud).
Override this method if CloudConnector require to do some request to complete the subscription after authentication (eg: to retreive user's timezone use in notification, to request subscriptionId on 3rd party cloud).
The function could be called several times for a remote device: * several ARTIK Cloud device are linked to the same remote account/device * re-subscription is called explicitly
phase: subscribe
Default impl:
Good(Empty.list)
a list of Requests that will be called in order to subscribe to notifications for a given device.
Override this method if CloudConnector require to do some request to complete the unsubscription.
Override this method if CloudConnector require to do some request to complete the unsubscription. If several ARTIK Cloud device share the same external Id, then the function will be called, only when the last device will be removed. To avoid remove notification on external Id shared by several devices.
phase: unsubscribe
Default impl:
Good(Empty.list)
a list of Requests that will be called in order to remove notifications/subscription on third party for a given device.
Override this method if CloudConnector requires to do some request to complete the unsubscription for the last connected device of a user.
Override this method if CloudConnector requires to do some request
to complete the unsubscription for the last connected device of a user.
This method will be called only if the CloudConnector is using external Id.
and if the device is the last device of the user for a given external Id.
This method will be called once the unsubscribe method has been done successfully for this device.
phase: unsubscribe
Default impl:
Good(Empty.list)
a list of Requests that will be called in order to remove notifications/subscription on third party for a given device.