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

Merge config, rest and realtime into one ably package #13

Merged
merged 1 commit into from
Apr 15, 2015

Conversation

rjeczalik
Copy link
Contributor

This CL:

  • moves config.Params to ably.Params
  • moves proto.PaginatedResource to ably.PaginatedResource
  • moves {rest,realtime}.Client to ably.{Rest,Realtime}Client to remove
    circular deps on existing ably.New{Rest,Realtime}Client functions

@kouno
Copy link
Contributor

kouno commented Apr 14, 2015

Well I guess we must embrace the single package philosophy... 😢

@@ -40,8 +40,8 @@ type PaginatedResource struct {
}

// NewPaginatedResource returns a new instance of PaginatedResource
// It needs to be a struct implementing ResourceReader which in our case is rest.Client.
func NewPaginatedResource(typ reflect.Type, path string, params *config.PaginateParams,
// It needs to be a struct implementing ResourceReader which in our case is rest.RestClient.
Copy link
Contributor

Choose a reason for hiding this comment

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

The comment still mention rest as the package name.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

It mentioned also non-existing ResourceReader interface. The newPaginatedResource is unexported now, so I've removed the doc.

@kouno
Copy link
Contributor

kouno commented Apr 14, 2015

Can you also update the README to reflect that change?

@mattheworiordan
Copy link
Member

@rjeczalik I assume this style of putting everything in the same namespace is more normal for Go?

This CL:

- moves config.Params to ably.Params
- moves proto.PaginatedResource to ably.PaginatedResource
- moves {rest,realtime}.Client to ably.{Rest,Realtime}Client to remove
  circular deps on existing ably.New{Rest,Realtime}Client functions
@rjeczalik
Copy link
Contributor Author

@kouno @mattheworiordan Please take a look.

I assume this style of putting everything in the same namespace is more normal for Go?

There's no rule nor practice of putting everything in one package no matter what. The normal for Go is to structure the packages around functionalities - functionalities in ably-go depends on each other, and with four separate packages it was a bit hard to keep the API clean. This single-package API is cleaner, however there's no issue revisiting it after it's fully complete.

@kouno
Copy link
Contributor

kouno commented Apr 15, 2015

This single-package API is cleaner

Ahah, once again a victory for @lmars who wrote it in a similar way before I jumped on the project. I hate when this guy is right ;).

@kouno
Copy link
Contributor

kouno commented Apr 15, 2015

Actually, I said nothing. Seems like @lmars did create the first rest/realtime package too! /~https://github.com/ably/ably-go/tree/90c6d6341c595270608df67b2622400de63e6359

🎊 🎆

Name: name,
client: client,
}

c.Presence = &Presence{
c.Presence = &RestPresence{
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add to the other issue that Presence needs to be a getter (presence()). This is to restrict the access to the Presence object.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Aleady done, see second bullet here #15.

kouno added a commit that referenced this pull request Apr 15, 2015
Merge config, rest and realtime into one ably package
@kouno kouno merged commit c1933ff into ably:master Apr 15, 2015
@rjeczalik rjeczalik deleted the merge-pkgs branch April 15, 2015 17:36
@lmars
Copy link
Member

lmars commented Apr 15, 2015

@kouno yep I originally had two packages because there were two clients, and there was a straight forward dependency from rest -> realtime, but maybe that is no longer the case 😉.

Feel free to mention me in other PRs if you want another opinion 😄.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants