Skip to content

Commit

Permalink
Objects API (#74)
Browse files Browse the repository at this point in the history
* object api

* grant v3 changes WIP

* Objects WIP

* Object API WIP

* Object API - spaces - WIP

* Object API - memberships - WIP

* Objects Memberships WIP

* object API - memberships WIP

* object API - memberships WIP

* objects WIP - enums

* Object WIP - Listeners

* Objects WIP, update space memberships and update members

* Example updates for Object API

* Objects API WIP

* Cleanup

* CreateUser unit tests

* CreateUser unit tests

* Create space unit tests

* Objects Unit tests WIP

* Objects Unit Tests, signature updates

* package fix

* some updates

* Object integration tests, renaming

* objects renaming

* Objects Events fixes

* Objects integration tests

* Integration test listener

* Integration test listener updates

* Integration test objects listener improvements

* Integration test objects listener improvements

* Telemetry for objects API

* Version bump

* codacy suggestions

* Codacy fixes 2

* Codacy fixes 3

* Update yml
  • Loading branch information
crimsonred authored and davidnub committed Aug 26, 2019
1 parent 6d5af5a commit 9b4d030
Show file tree
Hide file tree
Showing 50 changed files with 7,187 additions and 89 deletions.
30 changes: 29 additions & 1 deletion .pubnub.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
---
changelog:
-
changes:
-
text: "Objects API"
type: improvement
-
text: "Grant Optimizations"
type: improvement
date: Aug 28, 19
version: v4.2.7
-
changes:
-
Expand Down Expand Up @@ -351,6 +361,24 @@ features:
- SUBSCRIBE-WITH-USERSTATE
- SUBSCRIBE-PUBSUB-V2
- SUBSCRIBE-SIGNAL-LISTENER
- SUBSCRIBE-MEMBERSHIP-LISTENER
- SUBSCRIBE-SPACE-LISTENER
- SUBSCRIBE-USER-LISTENER
objects:
- OBJECTS-GET-USERS
- OBJECTS-GET-USER
- OBJECTS-CREATE-USER
- OBJECTS-UPDATE-USER
- OBJECTS-DELETE-USER
- OBJECTS-GET-SPACES
- OBJECTS-CREATE-SPACE
- OBJECTS-GET-SPACE
- OBJECTS-UPDATE-SPACE
- OBJECTS-DELETE-SPACE
- OBJECTS-GET-MEMBERSHIPS
- OBJECTS-MANAGE-MEMBERSHIPS
- OBJECTS-GET-MEMBERS
- OBJECTS-MANAGE-MEMBERS
time:
- TIME-TIME
unsubscribe:
Expand Down Expand Up @@ -380,4 +408,4 @@ supported-platforms:
- "Mac OS X 10.8 or later, amd64"
- "Windows 7 or later, amd64, 386"
version: "PubNub Go SDK"
version: v4.2.6
version: v4.2.7
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# PubNub 4.2.6 client for Go
# PubNub 4.2.7 client for Go
* Go (1.9+)

# Please direct all Support Questions and Concerns to [email protected]
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.2.6
4.2.7
9 changes: 2 additions & 7 deletions endpoints.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,10 @@ func buildURL(o endpointOpts) (*url.URL, error) {

signedInput := o.config().SubscribeKey + "\n" + o.config().PublishKey + "\n"

if o.operationType() == PNAccessManagerGrant ||
o.operationType() == PNAccessManagerRevoke {
signedInput += "grant\n"
} else {
signedInput += fmt.Sprintf("%s\n", path)
}
signedInput += fmt.Sprintf("%s\n", path)

signedInput += utils.PreparePamParams(query)
//o.config().Log.Println("signedInput:", signedInput)
o.config().Log.Println("signedInput:", signedInput)

signature = utils.GetHmacSha256(o.config().SecretKey, signedInput)
}
Expand Down
142 changes: 142 additions & 0 deletions enums.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,74 @@ type ReconnectionPolicy int
// PNPushType is used as an enum to catgorize the available Push Types
type PNPushType int

// PNUserSpaceInclude is used as an enum to catgorize the available User and Space include types
type PNUserSpaceInclude int

// PNMembershipsInclude is used as an enum to catgorize the available Memberships include types
type PNMembershipsInclude int

// PNMembersInclude is used as an enum to catgorize the available Members include types
type PNMembersInclude int

// PNObjectsEvent is used as an enum to catgorize the available Object Events
type PNObjectsEvent string

// PNObjectsEventType is used as an enum to catgorize the available Object Event types
type PNObjectsEventType string

const (
// PNObjectsUserEvent is the enum when the event of type `user` occurs
PNObjectsUserEvent PNObjectsEventType = "user"
// PNObjectsSpaceEvent is the enum when the event of type `space` occurs
PNObjectsSpaceEvent = "space"
// PNObjectsMembershipEvent is the enum when the event of type `membership` occurs
PNObjectsMembershipEvent = "membership"
)

const (
// PNObjectsEventCreate is the enum when the event `create` occurs
PNObjectsEventCreate PNObjectsEvent = "create"
// PNObjectsEventUpdate is the enum when the event `update` occurs
PNObjectsEventUpdate = "update"
// PNObjectsEventDelete is the enum when the event `delete` occurs
PNObjectsEventDelete = "delete"
)

const (
// PNUserSpaceCustom is the enum equivalent to the value `custom` available User and Space include types
PNUserSpaceCustom PNUserSpaceInclude = 1 + iota
)

func (s PNUserSpaceInclude) String() string {
return [...]string{"custom"}[s-1]
}

const (
// PNMembershipsCustom is the enum equivalent to the value `custom` available Memberships include types
PNMembershipsCustom PNMembershipsInclude = 1 + iota
// PNMembershipsSpace is the enum equivalent to the value `space` available Memberships include types
PNMembershipsSpace
// PNMembershipsSpaceCustom is the enum equivalent to the value `space.custom` available Memberships include types
PNMembershipsSpaceCustom
)

func (s PNMembershipsInclude) String() string {
return [...]string{"custom", "space", "space.custom"}[s-1]
}

const (
// PNMembersCustom is the enum equivalent to the value `custom` available Members include types
PNMembersCustom PNMembersInclude = 1 + iota
// PNMembersUser is the enum equivalent to the value `user` available Members include types
PNMembersUser
// PNMembersUserCustom is the enum equivalent to the value `user.custom` available Members include types
PNMembersUserCustom
)

func (s PNMembersInclude) String() string {
return [...]string{"custom", "user", "user.custom"}[s-1]
}

// PNMessageType is used as an enum to catgorize the Subscribe response.
type PNMessageType int

Expand Down Expand Up @@ -122,6 +190,34 @@ const (
PNMessageCountsOperation
// PNSignalOperation is the enum used for Signal opertaion.
PNSignalOperation
// PNCreateUserOperation is the enum used to create users in the Object API.
PNCreateUserOperation
// PNGetUsersOperation is the enum used to get users in the Object API.
PNGetUsersOperation
// PNGetUserOperation is the enum used to get user in the Object API.
PNGetUserOperation
// PNUpdateUserOperation is the enum used to update users in the Object API.
PNUpdateUserOperation
// PNDeleteUserOperation is the enum used to delete users in the Object API.
PNDeleteUserOperation
// PNGetSpaceOperation is the enum used to get space in the Object API.
PNGetSpaceOperation
// PNGetSpacesOperation is the enum used to get spaces in the Object API.
PNGetSpacesOperation
// PNCreateSpaceOperation is the enum used to create space in the Object API.
PNCreateSpaceOperation
// PNDeleteSpaceOperation is the enum used to delete space in the Object API.
PNDeleteSpaceOperation
// PNUpdateSpaceOperation is the enum used to update space in the Object API.
PNUpdateSpaceOperation
// PNGetMembershipsOperation is the enum used to get memberships in the Object API.
PNGetMembershipsOperation
// PNGetMembersOperation is the enum used to get members in the Object API.
PNGetMembersOperation
// PNManageMembershipsOperation is the enum used to manage memberships in the Object API.
PNManageMembershipsOperation
// PNManageMembersOperation is the enum used to manage members in the Object API.
PNManageMembersOperation
)

const (
Expand Down Expand Up @@ -175,6 +271,21 @@ var operations = [...]string{
"Grant",
"Revoke",
"Delete messages",
"Signal",
"Create User",
"Get Users",
"Fetch User",
"Update User",
"Delete User",
"Get Space",
"Get Spaces",
"Create Space",
"Delete Space",
"Update Space",
"PNGetMembershipsOperation",
"PNGetMembersOperation",
"PNManageMembershipsOperation",
"PNManageMembersOperation",
}

func (c StatusCategory) String() string {
Expand Down Expand Up @@ -292,6 +403,37 @@ func (t OperationType) String() string {
case PNDeleteMessagesOperation:
return "Delete messages"

case PNSignalOperation:
return "Signal"

case PNCreateUserOperation:
return "Create User"
case PNGetUsersOperation:
return "Get Users"
case PNGetUserOperation:
return "Fetch Users"
case PNUpdateUserOperation:
return "Update User"
case PNDeleteUserOperation:
return "Delete User"
case PNGetSpaceOperation:
return "Get Space"
case PNGetSpacesOperation:
return "Get Spaces"
case PNCreateSpaceOperation:
return "Create Space"
case PNDeleteSpaceOperation:
return "Delete Space"
case PNUpdateSpaceOperation:
return "Update Space"
case PNGetMembershipsOperation:
return "Get Memberships"
case PNGetMembersOperation:
return "Get Members"
case PNManageMembershipsOperation:
return "Manage Memberships"
case PNManageMembersOperation:
return "Manage Members"
default:
return "No Category Matched"
}
Expand Down
Loading

0 comments on commit 9b4d030

Please sign in to comment.