summaryrefslogtreecommitdiff
path: root/anteraja.c
diff options
context:
space:
mode:
authorꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id>2021-06-28 00:04:45 +0800
committerꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id>2021-06-28 00:04:45 +0800
commit2f2d49ab5e55343f4dd457ff4b897f5436edf446 (patch)
tree3f6a918a45d12c39184ebdebbcc7a69022084561 /anteraja.c
parent9c26a7ea4265b6f372ba40ea5fcb6fc440538813 (diff)
Provision enum for Anteraja
Diffstat (limited to 'anteraja.c')
-rw-r--r--anteraja.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/anteraja.c b/anteraja.c
index cf9d685..98af505 100644
--- a/anteraja.c
+++ b/anteraja.c
@@ -1,13 +1,19 @@
#include "shipping.h"
#include "handler.h"
+enum {
+ BASE_PATH,
+ ACCESS_KEY
+};
+
extern CURL *curl;
void anteraja_init(char *provisions[], struct shipping *shipping)
{
- shipping->base = malloc(strlen(*provisions) + 1);
- strcpy(shipping->base, *provisions);
- headers(shipping, (const char *[]){ "access-key-id", "secret-access-key", NULL }, ++provisions);
+ shipping->base = malloc(strlen(provisions[BASE_PATH]) + 1);
+ strcpy(shipping->base, provisions[BASE_PATH]);
+ headers(shipping, (const char *[]){ "access-key-id", "secret-access-key", NULL },
+ &provisions[ACCESS_KEY]);
shipping->headers = curl_slist_append(shipping->headers, "Content-Type:application/json");
}
@@ -33,13 +39,12 @@ size_t anteraja_services_handle(const char *contents, size_t size, size_t nmemb,
{
size_t realsize = size * nmemb;
handle(contents, realsize, &(struct container){ services, (const char *[]){
- "product_code",
- "product_name",
- "etd",
- "rates",
- "content",
- "services",
- NULL
- }});
+ "product_code",
+ "product_name",
+ "etd",
+ "rates",
+ "content",
+ "services",
+ NULL}});
return realsize;
}