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

JSON decoder / encoder #459

Merged
merged 20 commits into from
Jun 27, 2024
Merged

Conversation

parfeon
Copy link
Contributor

@parfeon parfeon commented Jun 24, 2024

feat: JSON decoder / encoder

Decoder to map server response directly to the data models.

feat: request / response-based interface

Configurable request objects require less convenience methods to interact with PubNub REST API.

feat: network layer rewritten as module

Decoder to map server response directly to the data models.

feat: request / response based interface

Configurable request objects require less convenience methods to interact with PubNub REST API.

feat: network layer rewritten as module
@parfeon parfeon added status: in progress This issue is being worked on. priority: medium This PR should be reviewed after all high priority PRs. type: feature This PR contains new feature. labels Jun 24, 2024
@parfeon parfeon self-assigned this Jun 24, 2024
@parfeon parfeon changed the title feat: JSON decoder / encoder JSON decoder / encoder Jun 24, 2024
@@ -61,8 +61,8 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
self.channel1 = @"bot";
self.channel2 = @"myCh";
self.channelGroup1 = @"myChannelGroup";
self.pubKey = @"demo";
self.subKey = @"demo";
self.pubKey = @"pub-c-92e62c76-408a-4ac4-aefc-a1d20a83b2a6";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope. Fixed.

PNPushNotificationsStateAuditCompletionBlock block = [handlerBlock copy];
PNParsedRequestCompletionBlock handler;

#ifndef PUBNUB_DISABLE_LOGGER
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could consider checking against the PUBNUB_DISABLE_LOGGER flag as a part of PNLogAPICall, so we would have such a check in one place only. Another idea could be overriding debugDescription for objects like userRequest. These two should shorten the overall syntax for logging. Let's leave it for now and consider pros and cons in the future

PNSetUUIDMetadataCompletionBlock block = [handleBlock copy];
PNParsedRequestCompletionBlock handler;

#ifndef PUBNUB_DISABLE_LOGGER
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like it's not used

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can drop it. Just added as a placeholder (it still will be stripped away during compilation).

PNRemoveUUIDMetadataCompletionBlock block = [handleBlock copy];
PNParsedRequestCompletionBlock handler;

#ifndef PUBNUB_DISABLE_LOGGER
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same, looks like it's not used

PNFetchUUIDMetadataCompletionBlock block = [handleBlock copy];
PNParsedRequestCompletionBlock handler;

#ifndef PUBNUB_DISABLE_LOGGER
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same, looks like it's not used

PNFetchAllUUIDMetadataCompletionBlock block = [handleBlock copy];
PNParsedRequestCompletionBlock handler;

#ifndef PUBNUB_DISABLE_LOGGER
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same here

PNSetChannelMetadataCompletionBlock block = [handleBlock copy];
PNParsedRequestCompletionBlock handler;

#ifndef PUBNUB_DISABLE_LOGGER
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And here

PNRemoveChannelMetadataCompletionBlock block = [handleBlock copy];
PNParsedRequestCompletionBlock handler;

#ifndef PUBNUB_DISABLE_LOGGER
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here too, perhaps the best way would be to find all these empty occurrences and delete them

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All Object API files has this as a placeholder. Need to sneak pick into another language which prints something and repeat the message here :)

@parfeon parfeon marked this pull request as ready for review June 25, 2024 14:34
@parfeon
Copy link
Contributor Author

parfeon commented Jun 27, 2024

@pubnub-release-bot release

@parfeon parfeon merged commit 538e65c into master Jun 27, 2024
7 checks passed
@parfeon parfeon deleted the modernization/request-response-data-models branch June 27, 2024 00:25
@pubnub-release-bot
Copy link

🚀 Release successfully completed 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: medium This PR should be reviewed after all high priority PRs. status: in progress This issue is being worked on. type: feature This PR contains new feature.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants