aboutsummaryrefslogtreecommitdiffhomepage
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/examples.md3
-rw-r--r--docs/write-request.example.c14
2 files changed, 17 insertions, 0 deletions
diff --git a/docs/examples.md b/docs/examples.md
index b517053..9d2a6d1 100644
--- a/docs/examples.md
+++ b/docs/examples.md
@@ -7,3 +7,6 @@ Example of constructing a service and writing it out:
Example of reading a service in and printing it for debugging:
\include read-service.example.c
+
+Example of making a request (to stdout instead of a transport):
+\include write-request.example.c
diff --git a/docs/write-request.example.c b/docs/write-request.example.c
new file mode 100644
index 0000000..3abe82e
--- /dev/null
+++ b/docs/write-request.example.c
@@ -0,0 +1,14 @@
+#include <libsparklepaw/request.h>
+
+void main() {
+ struct sprkl_request* request = sprkl_request_make_fetchservice(
+ SPRKL_SIGALGO_ED25519,
+ "aaaabbbbccccddddaaaabbbbccccddddaaaabbbbccccddddaaaabbbbccccdddd",
+ 0
+ );
+
+ int n = sprkl_request_write(request, stdout);
+ fprintf(stderr, "\nWrote %d bytes\n", n);
+
+ sprkl_request_freeall(request);
+}