From cf15e3a9a1036decb553ce5f988eac0e63dbfb07 Mon Sep 17 00:00:00 2001 From: Julien Neuhart Date: Fri, 6 Dec 2019 16:18:14 +0100 Subject: [PATCH] updating documentation (without go & php examples) --- build/docs/content/05-url.md | 32 +++++++++++ build/docs/content/10-webhook.md | 40 +++++++++++-- docs/index.html | 98 ++++++++++++++++++++++++++++---- 3 files changed, 155 insertions(+), 15 deletions(-) diff --git a/build/docs/content/05-url.md b/build/docs/content/05-url.md index 6517843a..7795b833 100644 --- a/build/docs/content/05-url.md +++ b/build/docs/content/05-url.md @@ -54,3 +54,35 @@ $request->setMargins(Request::NO_MARGINS); $dest = "result.pdf"; $client->store($request, $dest); ``` + +## Custom HTTP headers + +You may send your own HTTP headers to the `remoteURL`. + +For instance, by adding the HTTP header `Gotenberg-Remoteurl-Your-Header` to your request, +the API will send a request to the `remoteURL` with the HTTP header `Your-Header`. + +> **Attention:** the API uses a canonical format for the HTTP headers: +> it transforms the first +> letter and any letter following a hyphen to upper case; +> the rest are converted to lowercase. For example, the +> canonical key for `accept-encoding` is `Accept-Encoding`. + +### cURL + +```bash +$ curl --request POST \ + --url http://localhost:3000/convert/url \ + --header 'Content-Type: multipart/form-data' \ + --header 'Gotenberg-Remoteurl-Your-Header: Foo' \ + --form remoteURL=https://google.com \ + -o result.pdf +``` + +### Go + +// TODO + +### PHP + +// TODO \ No newline at end of file diff --git a/build/docs/content/10-webhook.md b/build/docs/content/10-webhook.md index fff2456d..dab6104f 100644 --- a/build/docs/content/10-webhook.md +++ b/build/docs/content/10-webhook.md @@ -58,9 +58,7 @@ It takes a float as value (e.g `2.5` for 2.5 seconds). > You may also define this value globally: see the [environment variables](#environment_variables.default_webhook_url_timeout) section. -### Examples - -#### cURL +### cURL ```bash $ curl --request POST \ @@ -71,7 +69,7 @@ $ curl --request POST \ --form webhookURLTimeout=2.5 ``` -#### Go +### Go ```golang import "github.com/thecodingmachine/gotenberg-go-client/v6" @@ -85,7 +83,7 @@ func main() { } ``` -#### PHP +### PHP ```php use TheCodingMachine\Gotenberg\Client; @@ -99,3 +97,35 @@ $request->setWebhookURL('http://myapp.com/webhook/'); $request->setWebhookURLTimeout(2.5); $resp = $client->post($request); ``` + +## Custom HTTP headers + +You may send your own HTTP headers to the `webhookURL`. + +For instance, by adding the HTTP header `Gotenberg-Webhookurl-Your-Header` to your request, +the API will send a request to the `webhookURL` with the HTTP header `Your-Header`. + +> **Attention:** the API uses a canonical format for the HTTP headers: +> it transforms the first +> letter and any letter following a hyphen to upper case; +> the rest are converted to lowercase. For example, the +> canonical key for `accept-encoding` is `Accept-Encoding`. + +### cURL + +```bash +$ curl --request POST \ + --url http://localhost:3000/convert/html \ + --header 'Content-Type: multipart/form-data' \ + --header 'Gotenberg-Webhookurl-Your-Header: Foo' \ + --form files=@index.html \ + --form webhookURL='http://myapp.com/webhook/' +``` + +### Go + +// TODO + +### PHP + +// TODO \ No newline at end of file diff --git a/docs/index.html b/docs/index.html index 85c3b75a..fb2f54d8 100755 --- a/docs/index.html +++ b/docs/index.html @@ -884,6 +884,47 @@ $dest = "result.pdf"; $client->store($request, $dest); +

Custom HTTP headers

+ +

You may send your own HTTP headers to the remoteURL.

+ +

For instance, by adding the HTTP header Gotenberg-Remoteurl-Your-Header to your request, +the API will send a request to the remoteURL with the HTTP header Your-Header.

+ +
+

Attention: the API uses a canonical format for the HTTP headers: +it transforms the first +letter and any letter following a hyphen to upper case; +the rest are converted to lowercase. For example, the +canonical key for accept-encoding is Accept-Encoding.

+
+ +

cURL

+ +
$ curl --request POST \
+    --url http://localhost:3000/convert/url \
+    --header 'Content-Type: multipart/form-data' \
+    --header 'Gotenberg-Remoteurl-Your-Header: Foo' \
+    --form remoteURL=https://google.com \
+    -o result.pdf
+
+ +

Go

+ +

// TODO

+ +

PHP

+ +

// TODO

+
@@ -1294,13 +1335,9 @@ $resp = $client->post($request);

You may also define this value globally: see the environment variables section.

-

Examples

- -

cURL

+cURL
$ curl --request POST \
     --url http://localhost:3000/convert/html \
@@ -1310,9 +1347,9 @@ $resp = $client->post($request);
     --form webhookURLTimeout=2.5
 
-

Go

+Go

import "github.com/thecodingmachine/gotenberg-go-client/v6"
 
@@ -1325,9 +1362,9 @@ $resp = $client->post($request);
 }
 
-

PHP

+PHP

use TheCodingMachine\Gotenberg\Client;
 use TheCodingMachine\Gotenberg\DocumentFactory;
@@ -1341,6 +1378,47 @@ $request->setWebhookURLTimeout(2.5);
 $resp = $client->post($request);
 
+

Custom HTTP headers

+ +

You may send your own HTTP headers to the webhookURL.

+ +

For instance, by adding the HTTP header Gotenberg-Webhookurl-Your-Header to your request, +the API will send a request to the webhookURL with the HTTP header Your-Header.

+ +
+

Attention: the API uses a canonical format for the HTTP headers: +it transforms the first +letter and any letter following a hyphen to upper case; +the rest are converted to lowercase. For example, the +canonical key for accept-encoding is Accept-Encoding.

+
+ +

cURL

+ +
$ curl --request POST \
+    --url http://localhost:3000/convert/html \
+    --header 'Content-Type: multipart/form-data' \
+    --header 'Gotenberg-Webhookurl-Your-Header: Foo' \
+    --form files=@index.html \
+    --form webhookURL='http://myapp.com/webhook/'
+
+ +

Go

+ +

// TODO

+ +

PHP

+ +

// TODO

+