From 0b30b4541a19ae64a4f04d159df3b21f26f4571b Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Mon, 4 Nov 2024 16:13:03 +1100 Subject: [PATCH] ON-44640 # Removed FormsAppsClient.UpdateStyles() --- CHANGELOG.md | 4 +++ OneBlink.SDK/FormsAppsClient.cs | 51 ++++++++++++++++----------------- OneBlink.SDK/models/Role.cs | 4 --- 3 files changed, 28 insertions(+), 31 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c99bde9..02b08440 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +### Removed + +- **[BREAKING]** `FormsAppsClient.updateStyles()` The `styles` property can be set using `FormsAppsClient.Create()` and updated using `FormsAppsClient.Update()` + ## [8.1.1] - 2024-10-29 ### Added diff --git a/OneBlink.SDK/FormsAppsClient.cs b/OneBlink.SDK/FormsAppsClient.cs index b7f4a3b1..2e215dcb 100644 --- a/OneBlink.SDK/FormsAppsClient.cs +++ b/OneBlink.SDK/FormsAppsClient.cs @@ -10,7 +10,7 @@ namespace OneBlink.SDK { public class FormsAppsClient { - OneBlinkApiClient oneBlinkApiClient; + private readonly OneBlinkApiClient oneBlinkApiClient; public FormsAppsClient(string accessKey, string secretKey, TenantName tenantName = TenantName.ONEBLINK) { @@ -39,25 +39,29 @@ public async Task VerifyJWT(string token) { throw new ArgumentException("Invalid token"); } - JWTPayload jWTPayload = new JWTPayload(); - jWTPayload.isSAMLUser = false; - jWTPayload.providerType = "Cognito"; - jWTPayload.providerUserId = rawJWTPayload.sub; - jWTPayload.userId = rawJWTPayload.sub; - jWTPayload.email = rawJWTPayload.email; - jWTPayload.emailVerified = rawJWTPayload.email_verified; - jWTPayload.firstName = rawJWTPayload.given_name; - jWTPayload.lastName = rawJWTPayload.family_name; - jWTPayload.fullName = rawJWTPayload.name; - jWTPayload.picture = rawJWTPayload.picture; - jWTPayload.role = rawJWTPayload.customRole; - jWTPayload.username = !string.IsNullOrEmpty(rawJWTPayload.email) ? rawJWTPayload.email : rawJWTPayload.sub; + JWTPayload jWTPayload = new JWTPayload + { + isSAMLUser = false, + providerType = "Cognito", + providerUserId = rawJWTPayload.sub, + userId = rawJWTPayload.sub, + email = rawJWTPayload.email, + emailVerified = rawJWTPayload.email_verified, + firstName = rawJWTPayload.given_name, + lastName = rawJWTPayload.family_name, + fullName = rawJWTPayload.name, + picture = rawJWTPayload.picture, + role = rawJWTPayload.customRole, + username = !string.IsNullOrEmpty(rawJWTPayload.email) ? rawJWTPayload.email : rawJWTPayload.sub + }; if (!string.IsNullOrEmpty(rawJWTPayload.customSupervisorEmail) && !string.IsNullOrEmpty(rawJWTPayload.customSupervisorName) && !string.IsNullOrEmpty(rawJWTPayload.customSupervisorUserId)) { - jWTPayload.supervisor = new FormSubmissionSupervisor(); - jWTPayload.supervisor.fullName = rawJWTPayload.customSupervisorName; - jWTPayload.supervisor.email = rawJWTPayload.customSupervisorEmail; - jWTPayload.supervisor.providerUserId = rawJWTPayload.customSupervisorUserId; + jWTPayload.supervisor = new FormSubmissionSupervisor + { + fullName = rawJWTPayload.customSupervisorName, + email = rawJWTPayload.customSupervisorEmail, + providerUserId = rawJWTPayload.customSupervisorUserId + }; } jWTPayload.phoneNumber = rawJWTPayload.customPhoneNumber; jWTPayload.phoneNumberVerified = rawJWTPayload.customPhoneNumberVerified; @@ -89,14 +93,14 @@ public async Task GetMyFormsApp(string token) where T : FormsAppBase public async Task Create(T newFormsApp) where T : FormsAppBase { string url = "/forms-apps"; - var formsApp = await this.oneBlinkApiClient.PostRequest(url, newFormsApp); + T formsApp = await this.oneBlinkApiClient.PostRequest(url, newFormsApp); return formsApp; } public async Task Update(FormsAppBase formsAppToUpdate) where T : FormsAppBase { string url = "/forms-apps/" + formsAppToUpdate.id.ToString(); - var formsApp = await this.oneBlinkApiClient.PutRequest(url, formsAppToUpdate); + T formsApp = await this.oneBlinkApiClient.PutRequest(url, formsAppToUpdate); return formsApp; } public async Task Delete(long id, bool overrideLock = false) @@ -104,13 +108,6 @@ public async Task Delete(long id, bool overrideLock = false) string url = "/forms-apps/" + id.ToString(); await this.oneBlinkApiClient.DeleteRequest(url); } - public async Task UpdateStyles(long id, T styles) where T : FormsAppStylesBase - { - string url = "/forms-apps/" + id.ToString() + "/styles"; - - var formsAppStyles = await this.oneBlinkApiClient.PutRequest(url, styles); - return formsAppStyles; - } public async Task SetSendingAddress(long id, NewFormsAppSendingAddress newFormsAppSendingAddress) { diff --git a/OneBlink.SDK/models/Role.cs b/OneBlink.SDK/models/Role.cs index 63837d8e..f2309bff 100644 --- a/OneBlink.SDK/models/Role.cs +++ b/OneBlink.SDK/models/Role.cs @@ -41,10 +41,6 @@ public string WEB_APP_HOSTING { get; set; } - public string FORMS_APP_STYLES - { - get; set; - } public string FORM_SUBMISSIONS { get; set;