Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ON-44640 # Removed FormsAppsClient.UpdateStyles() #338

Merged
merged 2 commits into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

- `nylasGrantId` and `nylasConfigurationId` to `FormSubmissionEventConfiguration`

### 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;
Zaxist marked this conversation as resolved.
Show resolved Hide resolved

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
Loading