Skip to content

Commit

Permalink
make types private to package
Browse files Browse the repository at this point in the history
  • Loading branch information
or-else committed Apr 19, 2020
1 parent b27d484 commit 2ed5cc0
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions server/push/tnpg/push_tnpg.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ type configType struct {
AuthToken string `json:"token"`
}

type TNPGResponse struct {
type tnpgResponse struct {
MessageID string `json:"msg_id,omitempty"`
ErrorCode string `json:"errcode,omitempty"`
ErrorMessage string `json:"errmsg,omitempty"`
}

type BatchResponse struct {
type batchResponse struct {
// Number of successfully sent messages.
SuccessCount int `json:"sent_count"`
// Number of failures.
Expand All @@ -49,7 +49,7 @@ type BatchResponse struct {
FatalCode string `json:"errcode,omitempty"`
FatalMessage string `json:"errmsg,omitempty"`
// Individual reponses in the same order as messages. Could be nil if the entire batch failed.
Responses []*TNPGResponse `json:"resp,omitempty"`
Responses []*tnpgResponse `json:"resp,omitempty"`

// Local values
httpCode int
Expand Down Expand Up @@ -102,7 +102,7 @@ func (Handler) Init(jsonconf string) error {
return nil
}

func postMessage(body interface{}, config *configType) (*BatchResponse, error) {
func postMessage(body interface{}, config *configType) (*batchResponse, error) {
buf := new(bytes.Buffer)
gzw := gzip.NewWriter(buf)
err := json.NewEncoder(gzw).Encode(body)
Expand All @@ -124,7 +124,7 @@ func postMessage(body interface{}, config *configType) (*BatchResponse, error) {
return nil, err
}

var batch BatchResponse
var batch batchResponse
gzr, err := gzip.NewReader(resp.Body)
if err == nil {
err = json.NewDecoder(gzr).Decode(&batch)
Expand Down Expand Up @@ -175,7 +175,7 @@ func sendPushes(rcpt *push.Receipt, config *configType) {
}
}

func handleResponse(batch *BatchResponse, messages []fcm.MessageData) {
func handleResponse(batch *batchResponse, messages []fcm.MessageData) {
if batch.FailureCount <= 0 {
return
}
Expand Down

0 comments on commit 2ed5cc0

Please sign in to comment.