Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
mfriesen committed Jun 10, 2024
1 parent 1a754b9 commit 8b85735
Show file tree
Hide file tree
Showing 9 changed files with 319 additions and 12 deletions.
42 changes: 42 additions & 0 deletions docs/openapi/openapi-iam.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2209,6 +2209,37 @@
- ApiAuthorization: []
x-amazon-apigateway-integration:
$ref: '#/components/x-amazon-apigateway-integrations/lambdaApi200'
/documents/{documentId}/attributes/{attributeKey}/versions:
get:
operationId: GetDocumentAttributeVersions
summary: Get document attribute's versions
description: Get a listing of a document's attribute versions; ONLY available with FormKiQ Pro and Enterprise
tags:
- Document Attributes
parameters:
- $ref: '#/components/parameters/siteIdParam'
- $ref: '#/components/parameters/documentIdParam'
- $ref: '#/components/parameters/attributeKeyParam'
- $ref: '#/components/parameters/limitParam'
- $ref: '#/components/parameters/nextParam'
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/GetDocumentAttributeVersionsResponse'
security:
- ApiAuthorization: []
x-amazon-apigateway-integration:
$ref: '#/components/x-amazon-apigateway-integrations/lambdaApi200'
/folders:
get:
operationId: GetFolderDocuments
Expand Down Expand Up @@ -5875,6 +5906,17 @@
isBase64:
type: boolean
description: Is the content Base64-encoded?
GetDocumentAttributeVersionsResponse:
type: object
properties:
next:
type: string
description: Next page of results token
attributes:
type: array
description: List of document attribute versions
items:
$ref: '#/components/schemas/DocumentAttribute'
GetDocumentVersionsResponse:
type: object
properties:
Expand Down
42 changes: 42 additions & 0 deletions docs/openapi/openapi-jwt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2209,6 +2209,37 @@
- ApiAuthorization: []
x-amazon-apigateway-integration:
$ref: '#/components/x-amazon-apigateway-integrations/lambdaApi200'
/documents/{documentId}/attributes/{attributeKey}/versions:
get:
operationId: GetDocumentAttributeVersions
summary: Get document attribute's versions
description: Get a listing of a document's attribute versions; ONLY available with FormKiQ Pro and Enterprise
tags:
- Document Attributes
parameters:
- $ref: '#/components/parameters/siteIdParam'
- $ref: '#/components/parameters/documentIdParam'
- $ref: '#/components/parameters/attributeKeyParam'
- $ref: '#/components/parameters/limitParam'
- $ref: '#/components/parameters/nextParam'
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/GetDocumentAttributeVersionsResponse'
security:
- ApiAuthorization: []
x-amazon-apigateway-integration:
$ref: '#/components/x-amazon-apigateway-integrations/lambdaApi200'
/folders:
get:
operationId: GetFolderDocuments
Expand Down Expand Up @@ -5875,6 +5906,17 @@
isBase64:
type: boolean
description: Is the content Base64-encoded?
GetDocumentAttributeVersionsResponse:
type: object
properties:
next:
type: string
description: Next page of results token
attributes:
type: array
description: List of document attribute versions
items:
$ref: '#/components/schemas/DocumentAttribute'
GetDocumentVersionsResponse:
type: object
properties:
Expand Down
42 changes: 42 additions & 0 deletions docs/openapi/openapi-key.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2209,6 +2209,37 @@
- ApiAuthorization: []
x-amazon-apigateway-integration:
$ref: '#/components/x-amazon-apigateway-integrations/lambdaApi200'
/documents/{documentId}/attributes/{attributeKey}/versions:
get:
operationId: GetDocumentAttributeVersions
summary: Get document attribute's versions
description: Get a listing of a document's attribute versions; ONLY available with FormKiQ Pro and Enterprise
tags:
- Document Attributes
parameters:
- $ref: '#/components/parameters/siteIdParam'
- $ref: '#/components/parameters/documentIdParam'
- $ref: '#/components/parameters/attributeKeyParam'
- $ref: '#/components/parameters/limitParam'
- $ref: '#/components/parameters/nextParam'
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/GetDocumentAttributeVersionsResponse'
security:
- ApiAuthorization: []
x-amazon-apigateway-integration:
$ref: '#/components/x-amazon-apigateway-integrations/lambdaApi200'
/folders:
get:
operationId: GetFolderDocuments
Expand Down Expand Up @@ -5875,6 +5906,17 @@
isBase64:
type: boolean
description: Is the content Base64-encoded?
GetDocumentAttributeVersionsResponse:
type: object
properties:
next:
type: string
description: Next page of results token
attributes:
type: array
description: List of document attribute versions
items:
$ref: '#/components/schemas/DocumentAttribute'
GetDocumentVersionsResponse:
type: object
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@

import java.net.URLDecoder;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.function.Function;
import java.util.stream.Collectors;
Expand All @@ -43,9 +44,9 @@
public class HttpRequestToApiHttpRequest implements Function<HttpRequest, ApiHttpRequest> {

/** {@link List} {@link String}. */
private List<String[]> resourceSplits;
private final List<String[]> resourceSplits;
/** {@link Collection} {@link String}. */
private Collection<String> resourceUrls;
private final Collection<String> resourceUrls;

/**
* constructor.
Expand All @@ -54,7 +55,7 @@ public class HttpRequestToApiHttpRequest implements Function<HttpRequest, ApiHtt
*/
public HttpRequestToApiHttpRequest(final Collection<String> resources) {
this.resourceUrls = resources;
this.resourceSplits = resources.stream().filter(r -> r != null).map(r -> r.split("/"))
this.resourceSplits = resources.stream().filter(Objects::nonNull).map(r -> r.split("/"))
.collect(Collectors.toList());
}

Expand All @@ -81,7 +82,7 @@ public ApiHttpRequest apply(final HttpRequest httpRequest) {
httpRequest.getQueryStringParameterList().stream().collect(Collectors.toMap(
p -> decode(p.getName().getValue()), p -> decode(p.getValues().get(0).getValue())));

String group = decoder.getGroups().stream().collect(Collectors.joining(" "));
String group = String.join(" ", decoder.getGroups());

return new ApiHttpRequest().httpMethod(httpRequest.getMethod().getValue()).resource(resource)
.path(path).pathParameters(pathParameters).queryParameters(queryParameters)
Expand Down Expand Up @@ -119,18 +120,29 @@ private String findResource(final String path) {
}

return match;
}).collect(Collectors.toList());
}).toList();

o = matches.size() == 1
? Optional.of(Arrays.asList(matches.get(0)).stream().collect(Collectors.joining("/")))
: Optional.empty();
if (matches.size() > 1) {

Optional<String[]> oo =
matches.stream().filter(m -> m[m.length - 1].equals(s[s.length - 1])).findFirst();

if (oo.isPresent()) {
matches = new ArrayList<>();
matches.add(oo.get());
} else {
matches = matches.stream().filter(m -> !m[m.length - 1].startsWith("{")).toList();
}
}

o = matches.size() == 1 ? Optional.of(String.join("/", matches.get(0))) : Optional.empty();
}

return o.orElse(null);
}

/**
* Generate {@link ApiGatewayRequestEvent} resource.
* Generate Path parameters.
*
* @param resource {@link String}
* @param path {@link String}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2237,6 +2237,37 @@ Resources:
- ApiAuthorization: []
x-amazon-apigateway-integration:
$ref: "#/components/x-amazon-apigateway-integrations/lambdaApi200"
/documents/{documentId}/attributes/{attributeKey}/versions:
get:
operationId: GetDocumentAttributeVersions
summary: Get document attribute's versions
description: Get a listing of a document's attribute versions; ONLY available with FormKiQ Pro and Enterprise
tags:
- Document Attributes
parameters:
- $ref: '#/components/parameters/siteIdParam'
- $ref: '#/components/parameters/documentIdParam'
- $ref: '#/components/parameters/attributeKeyParam'
- $ref: '#/components/parameters/limitParam'
- $ref: '#/components/parameters/nextParam'
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/GetDocumentAttributeVersionsResponse'
security:
- ApiAuthorization: []
x-amazon-apigateway-integration:
$ref: "#/components/x-amazon-apigateway-integrations/lambdaApi200"
/folders:
get:
operationId: GetFolderDocuments
Expand Down Expand Up @@ -5910,6 +5941,17 @@ Resources:
isBase64:
type: "boolean"
description: "Is the content Base64-encoded?"
GetDocumentAttributeVersionsResponse:
type: "object"
properties:
next:
type: "string"
description: "Next page of results token"
attributes:
type: "array"
description: "List of document attribute versions"
items:
$ref: "#/components/schemas/DocumentAttribute"
GetDocumentVersionsResponse:
type: "object"
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2237,6 +2237,37 @@ Resources:
- ApiAuthorization: []
x-amazon-apigateway-integration:
$ref: "#/components/x-amazon-apigateway-integrations/lambdaApi200"
/documents/{documentId}/attributes/{attributeKey}/versions:
get:
operationId: GetDocumentAttributeVersions
summary: Get document attribute's versions
description: Get a listing of a document's attribute versions; ONLY available with FormKiQ Pro and Enterprise
tags:
- Document Attributes
parameters:
- $ref: '#/components/parameters/siteIdParam'
- $ref: '#/components/parameters/documentIdParam'
- $ref: '#/components/parameters/attributeKeyParam'
- $ref: '#/components/parameters/limitParam'
- $ref: '#/components/parameters/nextParam'
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/GetDocumentAttributeVersionsResponse'
security:
- ApiAuthorization: []
x-amazon-apigateway-integration:
$ref: "#/components/x-amazon-apigateway-integrations/lambdaApi200"
/folders:
get:
operationId: GetFolderDocuments
Expand Down Expand Up @@ -5910,6 +5941,17 @@ Resources:
isBase64:
type: "boolean"
description: "Is the content Base64-encoded?"
GetDocumentAttributeVersionsResponse:
type: "object"
properties:
next:
type: "string"
description: "Next page of results token"
attributes:
type: "array"
description: "List of document attribute versions"
items:
$ref: "#/components/schemas/DocumentAttribute"
GetDocumentVersionsResponse:
type: "object"
properties:
Expand Down
Loading

0 comments on commit 8b85735

Please sign in to comment.