• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pusher / pusher-http-go / 12285846667

11 Dec 2024 10:17PM UTC coverage: 87.082%. Remained the same
12285846667

Pull #93

github

web-flow
Bump golang.org/x/crypto

Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.0.0-20200709230013-948cd5f35899 to 0.31.0.
- [Commits](https://github.com/golang/crypto/commits/v0.31.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Pull Request #93: Bump golang.org/x/crypto from 0.0.0-20200709230013-948cd5f35899 to 0.31.0

573 of 658 relevant lines covered (87.08%)

1.99 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

85.0
/response_parsing.go
1
package pusher
2

3
import (
4
        "encoding/json"
5
)
6

7
// Channel represents the information about a channel from the Pusher API.
8
type Channel struct {
9
        Name              string
10
        Occupied          bool `json:"occupied,omitempty"`
11
        UserCount         int  `json:"user_count,omitempty"`
12
        SubscriptionCount int  `json:"subscription_count,omitempty"`
13
}
14

15
// ChannelsList represents a list of channels received by the Pusher API.
16
type ChannelsList struct {
17
        Channels map[string]ChannelListItem `json:"channels"`
18
}
19

20
// ChannelListItem represents an item within ChannelsList
21
type ChannelListItem struct {
22
        UserCount int `json:"user_count"`
23
}
24

25
type TriggerChannelsList struct {
26
        Channels map[string]TriggerChannelListItem `json:"channels"`
27
}
28

29
type TriggerChannelListItem struct {
30
        UserCount         *int `json:"user_count,omitempty"`
31
        SubscriptionCount *int `json:"subscription_count,omitempty"`
32
}
33

34
type TriggerBatchChannelsList struct {
35
        Batch []TriggerBatchChannelListItem `json:"batch"`
36
}
37

38
type TriggerBatchChannelListItem struct {
39
        UserCount         *int `json:"user_count,omitempty"`
40
        SubscriptionCount *int `json:"subscription_count,omitempty"`
41
}
42

43
// Users represents a list of users in a presence-channel
44
type Users struct {
45
        List []User `json:"users"`
46
}
47

48
// User represents a user and contains their ID.
49
type User struct {
50
        ID string `json:"id"`
51
}
52

53
/*
54
MemberData represents what to assign to a channel member, consisting of a
55
`UserID` and any custom `UserInfo`.
56
*/
57
type MemberData struct {
58
        UserID   string            `json:"user_id"`
59
        UserInfo map[string]string `json:"user_info,omitempty"`
60
}
61

62
func unmarshalledTriggerChannelsList(response []byte) (*TriggerChannelsList, error) {
2✔
63
        channels := &TriggerChannelsList{}
2✔
64
        err := json.Unmarshal(response, channels)
2✔
65

2✔
66
        if err != nil {
4✔
67
                return nil, err
2✔
68
        }
2✔
69

70
        return channels, nil
2✔
71
}
72

73
func unmarshalledTriggerBatchChannelsList(response []byte) (*TriggerBatchChannelsList, error) {
2✔
74
        channels := &TriggerBatchChannelsList{}
2✔
75
        err := json.Unmarshal(response, channels)
2✔
76

2✔
77
        if err != nil {
2✔
78
                return nil, err
×
79
        }
×
80

81
        return channels, nil
2✔
82
}
83

84
func unmarshalledChannelsList(response []byte) (*ChannelsList, error) {
2✔
85
        channels := &ChannelsList{}
2✔
86
        err := json.Unmarshal(response, channels)
2✔
87

2✔
88
        if err != nil {
4✔
89
                return nil, err
2✔
90
        }
2✔
91

92
        return channels, nil
2✔
93
}
94

95
func unmarshalledChannel(response []byte, name string) (*Channel, error) {
2✔
96
        channel := &Channel{Name: name}
2✔
97
        err := json.Unmarshal(response, channel)
2✔
98

2✔
99
        if err != nil {
2✔
100
                return nil, err
×
101
        }
×
102

103
        return channel, nil
2✔
104
}
105

106
func unmarshalledChannelUsers(response []byte) (*Users, error) {
2✔
107
        users := &Users{}
2✔
108
        err := json.Unmarshal(response, users)
2✔
109

2✔
110
        if err != nil {
2✔
111
                return nil, err
×
112
        }
×
113

114
        return users, nil
2✔
115
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc