[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-merchant] 45/277: baseURL construction helper function'
From: |
gnunet |
Subject: |
[taler-merchant] 45/277: baseURL construction helper function' |
Date: |
Sun, 05 Jul 2020 20:49:18 +0200 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository merchant.
commit 874f09525fee53e8a69f040cd3cf9b4f369fdee5
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Fri Apr 24 19:40:48 2020 +0200
baseURL construction helper function'
---
src/include/taler_merchant_service.h | 15 +++++++++++++++
src/lib/merchant_api_common.c | 34 ++++++++++++++++++++++++++++++++++
2 files changed, 49 insertions(+)
diff --git a/src/include/taler_merchant_service.h
b/src/include/taler_merchant_service.h
index 435f65d..98acae6 100644
--- a/src/include/taler_merchant_service.h
+++ b/src/include/taler_merchant_service.h
@@ -121,6 +121,21 @@ TALER_MERCHANT_parse_error_details_ (const json_t
*response,
struct TALER_MERCHANT_HttpResponse *hr);
+/**
+ * Construct a new base URL using the existing @a base_url
+ * and the given @a instance_id. The result WILL end with
+ * '/'.
+ *
+ * @param base_url a merchant base URL without "/instances/" in it,
+ * must not be the empty string; MAY end with '/'.
+ * @param instance_id ID of an instance
+ * @return "${base_url}/instances/${instance_id}/"
+ */
+char *
+TALER_MERCHANT_baseurl_add_instance (const char *base_url,
+ const char *instance_id);
+
+
/* ********************* /public/config ****************** */
diff --git a/src/lib/merchant_api_common.c b/src/lib/merchant_api_common.c
index cb8de65..4d69e72 100644
--- a/src/lib/merchant_api_common.c
+++ b/src/lib/merchant_api_common.c
@@ -116,3 +116,37 @@ TALER_MERCHANT_parse_error_details_ (const json_t
*response,
hr->exchange_hint = json_string_value (jc);
}
}
+
+
+/**
+ * Construct a new base URL using the existing @a base_url
+ * and the given @a instance_id. The result WILL end with
+ * '/'.
+ *
+ * @param base_url a merchant base URL without "/instances/" in it,
+ * must not be the empty string; MAY end with '/'.
+ * @param instance_id ID of an instance
+ * @return "${base_url}/instances/${instance_id}/"
+ */
+char *
+TALER_MERCHANT_baseurl_add_instance (const char *base_url,
+ const char *instance_id)
+{
+ char *ret;
+ bool end_sl;
+
+ if ('\0' == *base_url)
+ {
+ GNUNET_break (0);
+ return NULL;
+ }
+ end_sl = '/' == base_url[strlen (base_url) - 1];
+
+ GNUNET_asprintf (&ret,
+ (end_sl)
+ ? "%sinstances/%s/"
+ : "%s/instances/%s/",
+ base_url,
+ instance_id);
+ return ret;
+}
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-merchant] 22/277: work on /products and /instances C API, (continued)
- [taler-merchant] 22/277: work on /products and /instances C API, gnunet, 2020/07/05
- [taler-merchant] 31/277: implemenet DELETE /products/, gnunet, 2020/07/05
- [taler-merchant] 27/277: implement GET /products/, gnunet, 2020/07/05
- [taler-merchant] 34/277: add GET /instance CMD, gnunet, 2020/07/05
- [taler-merchant] 32/277: move libtalermerchanttesting and test cases to src/testing/, gnunet, 2020/07/05
- [taler-merchant] 35/277: add CMD for GET /instances, gnunet, 2020/07/05
- [taler-merchant] 33/277: move libtalermerchanttesting and test cases to src/testing/, gnunet, 2020/07/05
- [taler-merchant] 36/277: add DELETE /instances/ID command, gnunet, 2020/07/05
- [taler-merchant] 37/277: add cmd for POST /instances, gnunet, 2020/07/05
- [taler-merchant] 39/277: add PATCH /instances/ID command, gnunet, 2020/07/05
- [taler-merchant] 45/277: baseURL construction helper function',
gnunet <=
- [taler-merchant] 44/277: fix ftbfs in lock logic, gnunet, 2020/07/05
- [taler-merchant] 41/277: add DELETE/PURGE /instances/ID command, gnunet, 2020/07/05
- [taler-merchant] 42/277: implement purge, gnunet, 2020/07/05
- [taler-merchant] 43/277: toward stesting, gnunet, 2020/07/05
- [taler-merchant] 50/277: misc fixes, gnunet, 2020/07/05
- [taler-merchant] 49/277: fix fmt string, gnunet, 2020/07/05
- [taler-merchant] 68/277: sql-ing, gnunet, 2020/07/05
- [taler-merchant] 53/277: implemente DELETE /orders/ID, gnunet, 2020/07/05
- [taler-merchant] 38/277: add PATCH /instances/ID command, gnunet, 2020/07/05
- [taler-merchant] 46/277: improve API, gnunet, 2020/07/05