-
Notifications
You must be signed in to change notification settings - Fork 0
/
unsubscribe_builder.go
41 lines (31 loc) · 1.11 KB
/
unsubscribe_builder.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package pubnub
type unsubscribeBuilder struct {
operation *UnsubscribeOperation
pubnub *PubNub
}
func newUnsubscribeBuilder(pubnub *PubNub) *unsubscribeBuilder {
builder := unsubscribeBuilder{
pubnub: pubnub,
operation: &UnsubscribeOperation{},
}
return &builder
}
// Channels set the channels for the Unsubscribe request.
func (b *unsubscribeBuilder) Channels(channels []string) *unsubscribeBuilder {
b.operation.Channels = channels
return b
}
// ChannelGroups set the Channel Groups for the Unsubscribe request.
func (b *unsubscribeBuilder) ChannelGroups(groups []string) *unsubscribeBuilder {
b.operation.ChannelGroups = groups
return b
}
// QueryParam accepts a map, the keys and values of the map are passed as the query string parameters of the URL called by the API.
func (b *unsubscribeBuilder) QueryParam(queryParam map[string]string) *unsubscribeBuilder {
b.operation.QueryParam = queryParam
return b
}
// Execute runs the Unsubscribe request and unsubscribes from the specified channels.
func (b *unsubscribeBuilder) Execute() {
b.pubnub.subscriptionManager.adaptUnsubscribe(b.operation)
}