From 12ef6e17b42a00251947c7647908f4c634cad2e7 Mon Sep 17 00:00:00 2001 From: milan Date: Mon, 13 Nov 2023 15:50:21 +0530 Subject: [PATCH] Fix: #193 - Unified base url, now directly copy and paste from the developer APIs --- .../privacyDashboard/PrivacyDashboard.kt | 5 ++- .../communication/BBConsentAPIServices.kt | 42 +++++++++---------- .../MainActivity.kt | 2 +- 3 files changed, 26 insertions(+), 23 deletions(-) diff --git a/PrivacyDashboard/src/main/java/com/github/privacyDashboard/PrivacyDashboard.kt b/PrivacyDashboard/src/main/java/com/github/privacyDashboard/PrivacyDashboard.kt index 423b71c..9fc7cd3 100644 --- a/PrivacyDashboard/src/main/java/com/github/privacyDashboard/PrivacyDashboard.kt +++ b/PrivacyDashboard/src/main/java/com/github/privacyDashboard/PrivacyDashboard.kt @@ -70,7 +70,10 @@ object PrivacyDashboard { * @param baseUrl */ fun withBaseUrl(baseUrl: String?): PrivacyDashboard { - this.mBaseUrl = baseUrl + if (baseUrl?.last().toString() == "/") + this.mBaseUrl = baseUrl + else + this.mBaseUrl = "$baseUrl/" return this } diff --git a/PrivacyDashboard/src/main/java/com/github/privacyDashboard/communication/BBConsentAPIServices.kt b/PrivacyDashboard/src/main/java/com/github/privacyDashboard/communication/BBConsentAPIServices.kt index 63c1885..87a8b4d 100644 --- a/PrivacyDashboard/src/main/java/com/github/privacyDashboard/communication/BBConsentAPIServices.kt +++ b/PrivacyDashboard/src/main/java/com/github/privacyDashboard/communication/BBConsentAPIServices.kt @@ -21,39 +21,39 @@ import retrofit2.Response import retrofit2.http.* interface BBConsentAPIServices { - @GET("v1/GetUserOrgsAndConsents") + @GET("GetUserOrgsAndConsents") suspend fun getOrganizationDetail( @Query("orgID") orgID: String? ): Response? - @GET("v2/service/organisation") + @GET("service/organisation") suspend fun getOrganizationDetailV2( @Header("X-ConsentBB-IndividualId") userID: String?, ): Response - @GET("v2/service/data-agreements") + @GET("service/data-agreements") suspend fun getDataAgreementsV2( @Header("X-ConsentBB-IndividualId") userID: String?, ): Response - @GET("v2/service/data-agreement/{dataAgreementId}") + @GET("service/data-agreement/{dataAgreementId}") suspend fun getDataAgreementV2( @Header("X-ConsentBB-IndividualId") userID: String?, @Path("dataAgreementId") dataAgreementId: String? ): Response? - @GET("v2/service/individual/record/consent-record") + @GET("service/individual/record/consent-record") suspend fun getDataAgreementRecordsV2( @Header("X-ConsentBB-IndividualId") userID: String? ): Response - @POST("v2/service/individual/record/data-agreement/{dataAgreementId}") + @POST("service/individual/record/data-agreement/{dataAgreementId}") suspend fun createDataAgreementRecordV2( @Header("X-ConsentBB-IndividualId") userID: String?, @Path("dataAgreementId") dataAgreementId: String? ): Response? - @GET("v1/users/{userID}/consenthistory") + @GET("users/{userID}/consenthistory") suspend fun getConsentHistory( @Path("userID") userID: String?, @Query("limit") limit: Int, @@ -61,14 +61,14 @@ interface BBConsentAPIServices { @Query("startid") startid: String? ): Response - @GET("v2/service/individual/record/consent-record/history") + @GET("service/individual/record/consent-record/history") suspend fun getConsentHistoryV2( @Header("X-ConsentBB-IndividualId") userID: String?, @Query("offset") offset: Int?, @Query("limit") limit: Int?, ): Response - @GET("v1/organizations/{orgID}/users/{userId}/consents/{consentId}/purposes/{purposeId}") + @GET("organizations/{orgID}/users/{userId}/consents/{consentId}/purposes/{purposeId}") suspend fun getConsentList( @Path("orgID") orgID: String?, @Path("userId") userId: String?, @@ -76,13 +76,13 @@ interface BBConsentAPIServices { @Path("purposeId") purposeId: String? ): Response? - @GET("v2/service/data-agreement/{dataAgreementId}/data-attributes") + @GET("service/data-agreement/{dataAgreementId}/data-attributes") suspend fun getAttributeListV2( @Header("X-ConsentBB-IndividualId") userID: String?, @Path("dataAgreementId") dataAgreementId: String? ): Response? - @PATCH("v1/organizations/{orgID}/users/{userId}/consents/{consentId}/purposes/{purposeId}/attributes/{attributeId}") + @PATCH("organizations/{orgID}/users/{userId}/consents/{consentId}/purposes/{purposeId}/attributes/{attributeId}") suspend fun setAttributeStatus( @Path("orgID") orgID: String?, @Path("userId") userId: String?, @@ -92,7 +92,7 @@ interface BBConsentAPIServices { @Body body: ConsentStatusRequest? ): Response? - @POST("v1/organizations/{orgID}/users/{userId}/consents/{consentId}/purposes/{purposeId}/status") + @POST("organizations/{orgID}/users/{userId}/consents/{consentId}/purposes/{purposeId}/status") suspend fun setOverallStatus( @Path("orgID") orgID: String?, @Path("userId") userId: String?, @@ -101,13 +101,13 @@ interface BBConsentAPIServices { @Body body: ConsentStatusRequest? ): Response? - @GET("v2/service/individual/record/data-agreement/{dataAgreementId}") + @GET("service/individual/record/data-agreement/{dataAgreementId}") suspend fun getDataAgreementRecordV2( @Header("X-ConsentBB-IndividualId") userID: String?, @Path("dataAgreementId") dataAgreementId: String?, ): Response? - @PUT("v2/service/individual/record/consent-record/{dataAgreementRecordId}") + @PUT("service/individual/record/consent-record/{dataAgreementRecordId}") suspend fun setOverallStatusV2( @Header("X-ConsentBB-IndividualId") userID: String?, @Path("dataAgreementRecordId") dataAgreementRecordId: String?, @@ -115,40 +115,40 @@ interface BBConsentAPIServices { @Body body: ConsentStatusRequestV2? ): Response? - @GET("v1/user/organizations/{orgId}/data-status") + @GET("user/organizations/{orgId}/data-status") suspend fun getOrgRequestStatus( @Path("orgId") orgId: String?, @Query("startid") startid: String? ): Response //data download and delete - @GET("v1/user/organizations/{orgId}/data-download/status") + @GET("user/organizations/{orgId}/data-download/status") suspend fun getDataDownloadStatus( @Path("orgId") orgId: String? ): Response - @GET("v1/user/organizations/{orgId}/data-delete/status") + @GET("user/organizations/{orgId}/data-delete/status") suspend fun getDataDeleteStatus( @Path("orgId") orgId: String? ): Response - @POST("v1/user/organizations/{orgId}/data-delete") + @POST("user/organizations/{orgId}/data-delete") suspend fun dataDeleteRequest( @Path("orgId") orgId: String? ): Response - @POST("v1/user/organizations/{orgId}/data-download") + @POST("user/organizations/{orgId}/data-download") suspend fun dataDownloadRequest( @Path("orgId") orgId: String? ): Response - @POST("v1/user/organizations/{orgId}/data-delete/{requestId}/cancel") + @POST("user/organizations/{orgId}/data-delete/{requestId}/cancel") suspend fun dataDeleteCancelRequest( @Path("orgId") orgId: String?, @Path("requestId") requestId: String? ): Response - @POST("v1/user/organizations/{orgId}/data-download/{requestId}/cancel") + @POST("user/organizations/{orgId}/data-download/{requestId}/cancel") suspend fun dataDownloadCancelRequest( @Path("orgId") orgId: String?, @Path("requestId") requestId: String? diff --git a/app/src/main/java/com/github/decentralised_dataexchange/MainActivity.kt b/app/src/main/java/com/github/decentralised_dataexchange/MainActivity.kt index c19f312..306fe03 100644 --- a/app/src/main/java/com/github/decentralised_dataexchange/MainActivity.kt +++ b/app/src/main/java/com/github/decentralised_dataexchange/MainActivity.kt @@ -49,7 +49,7 @@ class MainActivity : AppCompatActivity() { PrivacyDashboard.showPrivacyDashboard() .withApiKey("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJTY29wZXMiOlsic2VydmljZSJdLCJPcmdhbmlzYXRpb25JZCI6IjY1MjY1Nzk2OTM4MGYzNWZhMWMzMDI0NSIsIk9yZ2FuaXNhdGlvbkFkbWluSWQiOiI2NTI2NTc5NjkzODBmMzVmYTFjMzAyNDMiLCJleHAiOjE3MDI0NDUyMjR9.iMbsEe-nN_EHzWg0KOeUGTUR1F3xYH8lQBP90Mpt_ZY") .withUserId("65366979db611cb1948aca50") - .withBaseUrl("https://staging-consent-bb-api.igrant.io/") + .withBaseUrl("https://staging-consent-bb-api.igrant.io/v2") .start(this) }