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

Search form #95

Merged
merged 4 commits into from
Apr 30, 2021
Merged
Show file tree
Hide file tree
Changes from 2 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

- `displayAsCurrency` to `FormElement`
- `storageType` to `FormElement`
- `formsAppEnvironment` to `FormsClient Search`

## 2.1.0 (2021-04-27)

Expand Down
19 changes: 17 additions & 2 deletions OneBlink.SDK/FormsClient.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
Expand Down Expand Up @@ -47,7 +47,7 @@ public async Task<FormSubmission<T>> GetFormSubmission<T>(long formId, string su
return await GetFormSubmission<T>(formRetrievalData);
}

public async Task<FormsSearchResult> Search(bool? isAuthenticated, bool? isPublished, string name)
public async Task<FormsSearchResult> Search(bool? isAuthenticated, bool? isPublished, string name, int? formsAppEnvironment = null)
dsbegnoche marked this conversation as resolved.
Show resolved Hide resolved
{
string queryString = string.Empty;
if (isAuthenticated.HasValue)
Expand All @@ -70,6 +70,15 @@ public async Task<FormsSearchResult> Search(bool? isAuthenticated, bool? isPubli
}
queryString += "name=" + name;
}
if (formsAppEnvironment.HasValue)
dsbegnoche marked this conversation as resolved.
Show resolved Hide resolved
{
if (queryString != string.Empty)
{
queryString += "&";
}
queryString += "formsAppEnvironmentId=" + formsAppEnvironment.Value;
dsbegnoche marked this conversation as resolved.
Show resolved Hide resolved
}

string url = "/forms?" + queryString;
return await this.oneBlinkApiClient.GetRequest<FormsSearchResult>(url);
}
Expand Down Expand Up @@ -173,6 +182,7 @@ public async Task Delete(long id, bool overrideLock = false)
}
await this.oneBlinkApiClient.DeleteRequest(url);
}

private async Task<FormSubmission<T>> GetFormSubmission<T>(FormSubmissionRetrievalConfiguration formRetrievalData)
{
if (formRetrievalData == null || formRetrievalData.s3 == null || formRetrievalData.credentials == null)
Expand Down Expand Up @@ -307,4 +317,9 @@ private string _generateFormUrl(
return url;
}
}

public class WebhookRequest
{
public string callbackUrl { get; set; }
}
dsbegnoche marked this conversation as resolved.
Show resolved Hide resolved
}
5 changes: 4 additions & 1 deletion docs/forms-client.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,9 @@ A `FormSubmission<T>` class
bool? isAuthenticated = null;
bool? isPublished = null;
string name = null;
OneBlink.SDK.Model.FormsSearchResult response = await formsClient.Search(isAuthenticated, isPublished, name);
int? formsAppEnvironment = null;
dsbegnoche marked this conversation as resolved.
Show resolved Hide resolved

OneBlink.SDK.Model.FormsSearchResult response = await formsClient.Search(isAuthenticated, isPublished, name, formsAppEnvironment);
dsbegnoche marked this conversation as resolved.
Show resolved Hide resolved
```

### Parameters
Expand All @@ -132,6 +134,7 @@ OneBlink.SDK.Model.FormsSearchResult response = await formsClient.Search(isAuthe
| `isAuthenticated` | Yes | `bool?` | Return authenticated forms or unauthenticated forms. If null provided, all forms will be returned. |
| `isPublished` | Yes | `bool?` | Return published forms or unpublished forms. If null provided, all forms will be returned. |
| `name` | Yes | `string` | Search on the name property of a form. Can be a prefix, suffix or partial match. If null or whitespace provided, all forms will be returned. |
| `formsAppEnvironment` | No | `string` | Return only forms for a specific app environment. |
dsbegnoche marked this conversation as resolved.
Show resolved Hide resolved

### Throws

Expand Down