Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix history query parameter values #191

Merged
merged 2 commits into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions core/pbcc_fetch_history.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,16 @@ enum pubnub_res pbcc_fetch_history_prep(struct pbcc_context* pb,
sprintf(max_per_ch_cnt_buf, "%d", max_per_channel);
if (max_per_channel) { ADD_URL_PARAM(qparam, max, max_per_ch_cnt_buf); }

if (include_meta != pbccNotSet) { ADD_URL_PARAM(qparam, include_meta, include_meta == pbccTrue ? "1" : "0"); }
if (include_message_type != pbccNotSet) { ADD_URL_PARAM(qparam, include_message_type, include_meta == pbccTrue ? "1" : "0"); }
if (include_user_id != pbccNotSet) { ADD_URL_PARAM(qparam, include_uuid, include_user_id == pbccTrue ? "1" : "0"); }
if (include_meta != pbccNotSet) { ADD_URL_PARAM(qparam, include_meta, include_meta == pbccTrue ? "true" : "false"); }
if (include_message_type != pbccNotSet) { ADD_URL_PARAM(qparam, include_message_type, include_meta == pbccTrue ? "true" : "false"); }
if (include_user_id != pbccNotSet) { ADD_URL_PARAM(qparam, include_uuid, include_user_id == pbccTrue ? "true" : "false"); }
#if PUBNUB_CRYPTO_API
if (pb->secret_key == NULL) { ADD_URL_AUTH_PARAM(pb, qparam, auth); }
ADD_TS_TO_URL_PARAM();
#else
ADD_URL_AUTH_PARAM(pb, qparam, auth);
#endif
if (reverse != pbccNotSet) { ADD_URL_PARAM(qparam, reverse, reverse == pbccTrue ? "1" : "0"); }
if (reverse != pbccNotSet) { ADD_URL_PARAM(qparam, reverse, reverse == pbccTrue ? "true" : "false"); }
if (start) { ADD_URL_PARAM(qparam, start, start); }
if (end) { ADD_URL_PARAM(qparam, end, end); }

Expand Down
15 changes: 14 additions & 1 deletion core/samples/pubnub_fetch_history_sample.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,21 @@ int main(int argc, char* argv[])
res = pubnub_await(pbp);
}
if (PNR_OK == res) {
pubnub_chamebl_t response = pubnub_get_fetch_history(pbp);
printf("Got response for Fetch History! Response from Pubnub: %s\n",
pubnub_get_fetch_history(pbp).ptr);
response.ptr);
if (NULL == strstr(response.ptr, "\"message_type\"")) {
printf("\"message_type\" is missing in response.");
return 1;
}
if (NULL == strstr(response.ptr, "\"uuid\"")) {
printf("\"uuid\" is missing in response.");
return 1;
}
if (NULL == strstr(response.ptr, "\"meta\"")) {
printf("\"meta\" is missing in response.");
return 1;
}
}
else{
printf("pubnub_fetch_history() failed with code: %d('%s')\n",
Expand Down
Loading