Skip to content

Commit

Permalink
Add: #234 - Updated readme file
Browse files Browse the repository at this point in the history
  • Loading branch information
josmilan authored and georgepadayatti committed Nov 15, 2023
1 parent 15a65ce commit 036934f
Showing 1 changed file with 149 additions and 3 deletions.
152 changes: 149 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,26 @@ dependencies {
Maven:
```xml
<dependency>
<groupId>com.github.decentralised-dataexchange</groupId>
<artifactId>bb-consent-android-privacy-dashboard</artifactId>
<version><latest release></version>
<groupId>com.github.decentralised-dataexchange</groupId>
<artifactId>bb-consent-android-privacy-dashboard</artifactId>
<version><latest release></version>
</dependency>
```

## Integration

#### Privacy Dasboard
We can initiate the privacy dashboard by calling the below.
```
PrivacyDashboard.showPrivacyDashboard().withApiKey(<API key>)
.withUserId(<User ID>)
.withBaseUrl(<Base URL>).start(this)
```
We can also show the privacy dashboard with `accessToken`. For that use the below
```
.withAccessToken(<accessToken>)
```
> **_Note:_** If we have `accessToken` then no need to pass `API key` and `User ID`
To set the language we just need to add the following before the `start(this)`
```
Expand All @@ -62,6 +68,146 @@ To enable Ask me we just need to add the following before the `start(this)`
```
.enableAskMe()
```
#### Data Sharing UI

Register activity for result to get the response back from the Data sharing UI
```
var resultLauncher =
registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result ->
if (result.resultCode == Activity.RESULT_OK) {
val data: Intent? = result.data
if (data != null) {
Log.d("Data Agreement Record", data.getStringExtra("data_agreement_record") ?: "")
}
}
}
```
To initiate the Data sharing UI
```
val intent = DataSharingUI.showDataSharingUI()
.withApiKey(<API key>)
.withUserId(<User ID)
.withDataAgreementId(<Data Agreement ID>)
.withThirdPartyApplication(<Third party application name>,<Third party application logo>)
.withBaseUrl(<Base URL>)
.get(this)
resultLauncher.launch(intent)
```
We can also show the privacy dashboard with `accessToken`. For that use the below
```
.withAccessToken(<accessToken>)
```
> **_Note:_** If we have `accessToken` then no need to pass `API key` and `User ID`
To set the secondary button's text. Use the following before the `start(this)`
```
.secondaryButtonText(<Button text>)
```
In response, it will return a json string as follows. `Null` if the process failed
```
{
"id": "********************",
"dataAgreementId": "********************",
"dataAgreementRevisionId": "********************",
"dataAgreementRevisionHash": "*******************************",
"individualId": "********************",
"optIn": Boolean,
"state": "*********",
"signatureId": ""
}
```
#### Opt-in to Data Agreement
This function is used to provide the 3PP developer to opt-in to a data agreement.
```
PrivacyDashboard.optInToDataAgreement(
dataAgreementId = <Data argeement ID>,
baseUrl = <baseUrl>,
apiKey = <apiKey>,
userId = <userId>
)
```
We can also use `accessToken` to opt-in to data agreement. For that use
```
accessToken = <Access token>
```
> **_Note:_** If we have `accessToken` then no need to pass `API key` and `User ID`
In response, it will return a json string as follows. `Null` if the process failed
```
{
"id": "********************",
"dataAgreementId": "********************",
"dataAgreementRevisionId": "********************",
"dataAgreementRevisionHash": "*******************************",
"individualId": "********************",
"optIn": Boolean,
"state": "*********",
"signatureId": ""
}
```
#### Fetch Data Agreement
This function is used to fetch the data agreement using `dataAgreementId`
```
PrivacyDashboard.getDataAgreement(
dataAgreementId = <dataAgreementID>,
baseUrl = <baseUrl>,
apiKey = <apiKey>,
userId = <userId>
)
```
We can also use `accessToken` to opt-in to data agreement. For that use
```
accessToken = <Access token>
```
> **_Note:_** If we have `accessToken` then no need to pass `API key` and `User ID`
In response, it will return a json string.
#### Show data agreement policy
To show data agreement policy, fetch the data agreement with the above API, pass the response in this
```
PrivacyDashboard.showDataAgreementPolicy()
.withDataAgreement(<dataAgreementResponse>)
.withLocale("en")
.start(this)
```
#### Individual Functions
##### To Create an Individual
```
PrivacyDashboard.createAnIndividual(
baseUrl = <baseUrl>,
apiKey = <apiKey>,
)
```
there is also optional fields to pass `name`, `email` and `phone`
##### To fetch an Individual
```
PrivacyDashboard.fetchTheIndividual(
baseUrl = <baseUrl>,
apiKey = <apiKey>,
individualId = <Individual id>
)
```
##### To update an Individual
```
PrivacyDashboard.updateTheIndividual(
baseUrl = <baseUrl>,
apiKey = <apiKey>,
name = <name>,
email = <email>,
phone = <phone>,
individualId = <Individual id>
)
```
##### To fetch all individuals
```
PrivacyDashboard.updateTheIndividual(
baseUrl = <baseUrl>,
apiKey = <apiKey>,
offset = <offset(Int)>,
limit = <limit(Int)>
)
```

## Release Status

Expand Down

0 comments on commit 036934f

Please sign in to comment.