Skip to content

Commit

Permalink
chore: pass real export params
Browse files Browse the repository at this point in the history
Refs: #91
  • Loading branch information
yurtsevich-sbb committed Aug 8, 2024
1 parent 3f89835 commit d588880
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions docs/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -1299,10 +1299,10 @@
"type" : "string"
}
},
"wildcardType" : {
"wildcardSubtype" : {
"type" : "boolean"
},
"wildcardSubtype" : {
"wildcardType" : {
"type" : "boolean"
}
}
Expand Down Expand Up @@ -1393,10 +1393,10 @@
"type" : "string"
}
},
"wildcardType" : {
"wildcardSubtype" : {
"type" : "boolean"
},
"wildcardSubtype" : {
"wildcardType" : {
"type" : "boolean"
}
}
Expand Down Expand Up @@ -1505,10 +1505,10 @@
"type" : "string"
}
},
"wildcardType" : {
"wildcardSubtype" : {
"type" : "boolean"
},
"wildcardSubtype" : {
"wildcardType" : {
"type" : "boolean"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,20 +153,20 @@ public byte[] convertToPdf(@NotNull ExportParams exportParams, @Nullable ExportM
WebhooksModel hooksModel = new WebhooksSettings().load(exportParams.getProjectId(), SettingId.fromName(exportParams.getWebhooks()));
String result = htmlContent;
for (String hook : hooksModel.getWebhooks()) {
result = applyHook(hook, result);
result = applyHook(hook, exportParams, result);
}
return result;
}

private @NotNull String applyHook(@NotNull String hook, @NotNull String htmlContent) {
private @NotNull String applyHook(@NotNull String hook, @NotNull ExportParams exportParams, @NotNull String htmlContent) {
Client client = null;
try {
client = ClientBuilder.newClient();
WebTarget webTarget = client.target(hook).register(MultiPartFeature.class);

FormDataMultiPart multipart = new FormDataMultiPart();
multipart.bodyPart(new FormDataBodyPart("exportParams", new ObjectMapper().writeValueAsString(exportParams), MediaType.APPLICATION_JSON_TYPE));
multipart.bodyPart(new FormDataBodyPart("html", htmlContent.getBytes(StandardCharsets.UTF_8), MediaType.APPLICATION_OCTET_STREAM_TYPE));
multipart.bodyPart(new FormDataBodyPart("exportParams", new ObjectMapper().writeValueAsString(new ExportParams()), MediaType.APPLICATION_JSON_TYPE));

try (Response response = webTarget.request(MediaType.TEXT_PLAIN).post(Entity.entity(multipart, multipart.getMediaType()))) {
if (response.getStatus() == Response.Status.OK.getStatusCode()) {
Expand Down

0 comments on commit d588880

Please sign in to comment.