Skip to content

Commit

Permalink
v1.8.5 (#34)
Browse files Browse the repository at this point in the history
* Added support for Webhook Actions

* Added GET /documents/{documentId}/fulltext endpoint
  • Loading branch information
mfriesen committed Sep 1, 2022
1 parent 1ac7fa1 commit 6fe588e
Show file tree
Hide file tree
Showing 11 changed files with 456 additions and 118 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,7 @@ public enum ActionType {
/** Full Text. */
FULLTEXT,
/** OCR. */
OCR;
OCR,
/** WebHook. */
WEBHOOK;
}
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def moduleName = "formkiq-core"
repositories { mavenCentral() }

allprojects {
version = '1.8.4'
version = '1.8.5'
ext.awsCognitoVersion = '1.4.1'
group = 'com.formkiq.stacks'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@ public ApiRequestHandlerResponse delete(final LambdaLogger logger,
ApiMapResponse resp = new ApiMapResponse();
return new ApiRequestHandlerResponse(SC_PAYMENT, resp);
}

@Override
public ApiRequestHandlerResponse get(final LambdaLogger logger,
final ApiGatewayRequestEvent event, final ApiAuthorizer authorizer,
final AwsServiceCache awsservice) throws Exception {
ApiMapResponse resp = new ApiMapResponse();
return new ApiRequestHandlerResponse(SC_PAYMENT, resp);
}

@Override
public String getRequestUrl() {
Expand Down
76 changes: 53 additions & 23 deletions lambda-api/src/main/resources/cloudformation/api-iam.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Resources:
title:
Fn::Sub: "${AWS::StackName} IAM API - ${AppEnvironment}"
description: "FormKiQ IAM API"
version: "1.8.3"
version: "1.8.5"
paths:
/version:
get:
Expand Down Expand Up @@ -979,6 +979,31 @@ Resources:
x-amazon-apigateway-integration:
$ref: "#/components/x-amazon-apigateway-integrations/antivirusLambdaApi200"
/documents/{documentId}/fulltext:
get:
description: Retrieves an OpenSearch document's details, i.e., metadata
tags:
- Enterprise Fulltext
parameters:
- $ref: '#/components/parameters/documentIdParam'
- $ref: '#/components/parameters/siteIdParam'
responses:
'200':
description: 200 OK
headers:
Access-Control-Allow-Origin:
$ref: '#/components/headers/AccessControlAllowOrigin'
Access-Control-Allow-Methods:
$ref: '#/components/headers/AccessControlAllowMethods'
Access-Control-Allow-Headers:
$ref: '#/components/headers/AccessControlAllowHeaders'
content:
application/json:
schema:
$ref: '#/components/schemas/FulltextDocument'
security:
- sigv4: []
x-amazon-apigateway-integration:
$ref: "#/components/x-amazon-apigateway-integrations/fulltextLambdaApi200"
delete:
description: Removes full text search for a document; ONLY available with FormKiQ Enterprise
tags:
Expand Down Expand Up @@ -1955,13 +1980,38 @@ Resources:
type: "array"
description: "List of search result documents"
items:
$ref: "#/components/schemas/FulltextDocument"
$ref: "#/components/schemas/FulltextSearchItem"
FulltextSearchItem:
type: "object"
properties:
siteId:
type: "string"
description: "Site Identifier"
path:
type: "string"
description: "Path or Name of document"
insertedDate:
type: "string"
format: "date-time"
description: "Inserted Timestamp"
documentId:
type: "string"
format: "uuid"
description: "Document Identifier"
createdBy:
type: "string"
description: "User who added document"
tags:
type: "object"
FulltextDocument:
type: "object"
properties:
siteId:
type: "string"
description: "Site Identifier"
content:
type: "string"
description: "Content of document"
path:
type: "string"
description: "Path or Name of document"
Expand All @@ -1977,7 +2027,7 @@ Resources:
type: "string"
description: "User who added document"
tags:
type: "object"
type: "object"
DocumentSearchResults:
type: "object"
properties:
Expand Down Expand Up @@ -2240,26 +2290,6 @@ Resources:
contentUrl:
type: "string"
description: "Url which contains Document content"
DeleteFulltextTags:
type: object
properties:
tags:
type: "array"
description: "List of tags"
items:
type: "object"
properties:
key:
type: "string"
description: "Tag key"
value:
type: "string"
description: "Tag value"
values:
description: "Tag values"
type: "array"
items:
type: "string"
FulltextUpdateBody:
type: object
properties:
Expand Down
76 changes: 53 additions & 23 deletions lambda-api/src/main/resources/cloudformation/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Resources:
title:
Fn::Sub: "${AWS::StackName} HTTP API - ${AppEnvironment}"
description: "FormKiQ HTTP API"
version: "1.8.3"
version: "1.8.5"
paths:
/version:
get:
Expand Down Expand Up @@ -979,6 +979,31 @@ Resources:
x-amazon-apigateway-integration:
$ref: "#/components/x-amazon-apigateway-integrations/antivirusLambdaApi200"
/documents/{documentId}/fulltext:
get:
description: Retrieves an OpenSearch document's details, i.e., metadata
tags:
- Enterprise Fulltext
parameters:
- $ref: '#/components/parameters/documentIdParam'
- $ref: '#/components/parameters/siteIdParam'
responses:
'200':
description: 200 OK
headers:
Access-Control-Allow-Origin:
$ref: '#/components/headers/AccessControlAllowOrigin'
Access-Control-Allow-Methods:
$ref: '#/components/headers/AccessControlAllowMethods'
Access-Control-Allow-Headers:
$ref: '#/components/headers/AccessControlAllowHeaders'
content:
application/json:
schema:
$ref: '#/components/schemas/FulltextDocument'
security:
- AuthorizationCognito: []
x-amazon-apigateway-integration:
$ref: "#/components/x-amazon-apigateway-integrations/fulltextLambdaApi200"
delete:
description: Removes full text search for a document; ONLY available with FormKiQ Enterprise
tags:
Expand Down Expand Up @@ -1955,13 +1980,38 @@ Resources:
type: "array"
description: "List of search result documents"
items:
$ref: "#/components/schemas/FulltextDocument"
$ref: "#/components/schemas/FulltextSearchItem"
FulltextSearchItem:
type: "object"
properties:
siteId:
type: "string"
description: "Site Identifier"
path:
type: "string"
description: "Path or Name of document"
insertedDate:
type: "string"
format: "date-time"
description: "Inserted Timestamp"
documentId:
type: "string"
format: "uuid"
description: "Document Identifier"
createdBy:
type: "string"
description: "User who added document"
tags:
type: "object"
FulltextDocument:
type: "object"
properties:
siteId:
type: "string"
description: "Site Identifier"
content:
type: "string"
description: "Content of document"
path:
type: "string"
description: "Path or Name of document"
Expand All @@ -1977,7 +2027,7 @@ Resources:
type: "string"
description: "User who added document"
tags:
type: "object"
type: "object"
DocumentSearchResults:
type: "object"
properties:
Expand Down Expand Up @@ -2240,26 +2290,6 @@ Resources:
contentUrl:
type: "string"
description: "Url which contains Document content"
DeleteFulltextTags:
type: object
properties:
tags:
type: "array"
description: "List of tags"
items:
type: "object"
properties:
key:
type: "string"
description: "Tag key"
value:
type: "string"
description: "Tag value"
values:
description: "Tag values"
type: "array"
items:
type: "string"
FulltextUpdateBody:
type: object
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,34 @@
@ExtendWith(DynamoDbExtension.class)
public class ApiDocumentsFulltextRequestTest extends AbstractRequestHandler {

/**
* GET /documents/{documentId}/fulltext request.
*
* @throws Exception an error has occurred
*/
@SuppressWarnings("unchecked")
@Test
public void testHandleGetDocumentFulltext01() throws Exception {
for (String siteId : Arrays.asList(null, UUID.randomUUID().toString())) {
// given
ApiGatewayRequestEvent event = toRequestEvent("/request-put-documents-fulltext.json");
event.setHttpMethod("get");
addParameter(event, "siteId", siteId);
setPathParameter(event, "documentId", "1");

// when
String response = handleRequest(event);

// then
Map<String, String> m = GsonUtil.getInstance().fromJson(response, Map.class);

final int mapsize = 3;
assertEquals(mapsize, m.size());
assertEquals("402.0", String.valueOf(m.get("statusCode")));
assertEquals(getHeaders(), "\"headers\":" + GsonUtil.getInstance().toJson(m.get("headers")));
}
}

/**
* PUT /documents/{documentId}/fulltext request.
*
Expand Down
Loading

0 comments on commit 6fe588e

Please sign in to comment.