Skip to content

Commit

Permalink
Fix history query parameter values (#191)
Browse files Browse the repository at this point in the history
fix(history): fix query parameter values

Fix query values for boolean flags for history endpoint (`include meta`, `include uuid`,
`include message type` and `reverse`).
  • Loading branch information
parfeon authored Aug 5, 2024
1 parent 4789b71 commit 532927a
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 14 deletions.
21 changes: 13 additions & 8 deletions .pubnub.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
name: c-core
schema: 1
version: "4.12.0"
version: "4.12.1"
scm: github.com/pubnub/c-core
changelog:
- date: 2024-08-05
version: v4.12.1
changes:
- type: bug
text: "Fix query values for boolean flags for history endpoint (`include meta`, `include uuid`, `include message type` and `reverse`)."
- date: 2024-07-29
version: v4.12.0
changes:
Expand Down Expand Up @@ -828,7 +833,7 @@ sdks:
distribution-type: source code
distribution-repository: GitHub release
package-name: C-Core
location: https://github.com/pubnub/c-core/releases/tag/v4.12.0
location: https://github.com/pubnub/c-core/releases/tag/v4.12.1
requires:
-
name: "miniz"
Expand Down Expand Up @@ -894,7 +899,7 @@ sdks:
distribution-type: source code
distribution-repository: GitHub release
package-name: C-Core
location: https://github.com/pubnub/c-core/releases/tag/v4.12.0
location: https://github.com/pubnub/c-core/releases/tag/v4.12.1
requires:
-
name: "miniz"
Expand Down Expand Up @@ -960,7 +965,7 @@ sdks:
distribution-type: source code
distribution-repository: GitHub release
package-name: C-Core
location: https://github.com/pubnub/c-core/releases/tag/v4.12.0
location: https://github.com/pubnub/c-core/releases/tag/v4.12.1
requires:
-
name: "miniz"
Expand Down Expand Up @@ -1022,7 +1027,7 @@ sdks:
distribution-type: source code
distribution-repository: GitHub release
package-name: C-Core
location: https://github.com/pubnub/c-core/releases/tag/v4.12.0
location: https://github.com/pubnub/c-core/releases/tag/v4.12.1
requires:
-
name: "miniz"
Expand Down Expand Up @@ -1083,7 +1088,7 @@ sdks:
distribution-type: source code
distribution-repository: GitHub release
package-name: C-Core
location: https://github.com/pubnub/c-core/releases/tag/v4.12.0
location: https://github.com/pubnub/c-core/releases/tag/v4.12.1
requires:
-
name: "miniz"
Expand Down Expand Up @@ -1139,7 +1144,7 @@ sdks:
distribution-type: source code
distribution-repository: GitHub release
package-name: C-Core
location: https://github.com/pubnub/c-core/releases/tag/v4.12.0
location: https://github.com/pubnub/c-core/releases/tag/v4.12.1
requires:
-
name: "miniz"
Expand Down Expand Up @@ -1192,7 +1197,7 @@ sdks:
distribution-type: source code
distribution-repository: GitHub release
package-name: C-Core
location: https://github.com/pubnub/c-core/releases/tag/v4.12.0
location: https://github.com/pubnub/c-core/releases/tag/v4.12.1
requires:
-
name: "miniz"
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## v4.12.1
August 05 2024

#### Fixed
- Fix query values for boolean flags for history endpoint (`include meta`, `include uuid`, `include message type` and `reverse`).

## v4.12.0
July 29 2024

Expand Down
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
2 changes: 1 addition & 1 deletion core/pubnub_version_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#define INC_PUBNUB_VERSION_INTERNAL


#define PUBNUB_SDK_VERSION "4.12.0"
#define PUBNUB_SDK_VERSION "4.12.1"


#endif /* !defined INC_PUBNUB_VERSION_INTERNAL */
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

0 comments on commit 532927a

Please sign in to comment.