Skip to content

Commit

Permalink
ON-44640 # Removed FormsAppsClient.UpdateStyles()
Browse files Browse the repository at this point in the history
  • Loading branch information
mymattcarroll committed Nov 4, 2024
1 parent d961899 commit 0b30b45
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 31 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
51 changes: 24 additions & 27 deletions OneBlink.SDK/FormsAppsClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -39,25 +39,29 @@ public async Task<JWTPayload> 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;
Expand Down Expand Up @@ -89,28 +93,21 @@ public async Task<T> GetMyFormsApp<T>(string token) where T : FormsAppBase
public async Task<T> Create<T>(T newFormsApp) where T : FormsAppBase
{
string url = "/forms-apps";
var formsApp = await this.oneBlinkApiClient.PostRequest<T, T>(url, newFormsApp);
T formsApp = await this.oneBlinkApiClient.PostRequest<T, T>(url, newFormsApp);
return formsApp;
}
public async Task<T> Update<T>(FormsAppBase formsAppToUpdate) where T : FormsAppBase
{
string url = "/forms-apps/" + formsAppToUpdate.id.ToString();

var formsApp = await this.oneBlinkApiClient.PutRequest<FormsAppBase, T>(url, formsAppToUpdate);
T formsApp = await this.oneBlinkApiClient.PutRequest<FormsAppBase, T>(url, formsAppToUpdate);
return formsApp;
}
public async Task Delete(long id, bool overrideLock = false)
{
string url = "/forms-apps/" + id.ToString();
await this.oneBlinkApiClient.DeleteRequest(url);
}
public async Task<T> UpdateStyles<T>(long id, T styles) where T : FormsAppStylesBase
{
string url = "/forms-apps/" + id.ToString() + "/styles";

var formsAppStyles = await this.oneBlinkApiClient.PutRequest<T, T>(url, styles);
return formsAppStyles;
}

public async Task<FormsAppSendingAddressResponse> SetSendingAddress(long id, NewFormsAppSendingAddress newFormsAppSendingAddress)
{
Expand Down
4 changes: 0 additions & 4 deletions OneBlink.SDK/models/Role.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@ public string WEB_APP_HOSTING
{
get; set;
}
public string FORMS_APP_STYLES
{
get; set;
}
public string FORM_SUBMISSIONS
{
get; set;
Expand Down

0 comments on commit 0b30b45

Please sign in to comment.