Skip to content

Commit 075a147

Browse files
committed
Rename occurences of ResourceParams to Params to prevent resource.ResourceParams
1 parent 53def59 commit 075a147

File tree

10 files changed

+44
-44
lines changed

10 files changed

+44
-44
lines changed

lookup/lookup.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ type Lookup struct {
2727
HLR *hlr.HLR
2828
}
2929

30-
// LookupParams provide additional lookup information.
31-
type LookupParams struct {
30+
// Params provide additional lookup information.
31+
type Params struct {
3232
CountryCode string
3333
Reference string
3434
}
@@ -45,7 +45,7 @@ const hlrPath = "hlr"
4545
const lookupPath = "lookup"
4646

4747
// Create performs a new lookup for the specified number.
48-
func Create(c *messagebird.Client, phoneNumber string, params *LookupParams) (*Lookup, error) {
48+
func Create(c *messagebird.Client, phoneNumber string, params *Params) (*Lookup, error) {
4949
urlParams := paramsForLookup(params)
5050
path := lookupPath + "/" + phoneNumber + "?" + urlParams.Encode()
5151

@@ -58,7 +58,7 @@ func Create(c *messagebird.Client, phoneNumber string, params *LookupParams) (*L
5858
}
5959

6060
// CreateHLR creates a new HLR lookup for the specified number.
61-
func CreateHLR(c *messagebird.Client, phoneNumber string, params *LookupParams) (*hlr.HLR, error) {
61+
func CreateHLR(c *messagebird.Client, phoneNumber string, params *Params) (*hlr.HLR, error) {
6262
requestData := requestDataForLookup(params)
6363
path := lookupPath + "/" + phoneNumber + "/" + hlrPath
6464

@@ -71,7 +71,7 @@ func CreateHLR(c *messagebird.Client, phoneNumber string, params *LookupParams)
7171
}
7272

7373
// ReadHLR performs a HLR lookup for the specified number.
74-
func ReadHLR(c *messagebird.Client, phoneNumber string, params *LookupParams) (*hlr.HLR, error) {
74+
func ReadHLR(c *messagebird.Client, phoneNumber string, params *Params) (*hlr.HLR, error) {
7575
urlParams := paramsForLookup(params)
7676
path := lookupPath + "/" + phoneNumber + "/" + hlrPath + "?" + urlParams.Encode()
7777

@@ -83,7 +83,7 @@ func ReadHLR(c *messagebird.Client, phoneNumber string, params *LookupParams) (*
8383
return hlr, nil
8484
}
8585

86-
func requestDataForLookup(params *LookupParams) *lookupRequest {
86+
func requestDataForLookup(params *Params) *lookupRequest {
8787
request := &lookupRequest{}
8888

8989
if params == nil {
@@ -96,7 +96,7 @@ func requestDataForLookup(params *LookupParams) *lookupRequest {
9696
return request
9797
}
9898

99-
func paramsForLookup(params *LookupParams) *url.Values {
99+
func paramsForLookup(params *Params) *url.Values {
100100
urlParams := &url.Values{}
101101

102102
if params == nil {

lookup/lookup_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func TestCreate(t *testing.T) {
4949
client := messagebirdtest.Client(t)
5050

5151
phoneNumber := "31624971134"
52-
lookup, err := Create(client, phoneNumber, &LookupParams{CountryCode: "NL"})
52+
lookup, err := Create(client, phoneNumber, &Params{CountryCode: "NL"})
5353
if err != nil {
5454
t.Fatalf("Didn't expect error while doing the lookup: %s", err)
5555
}
@@ -94,15 +94,15 @@ func TestReadHLR(t *testing.T) {
9494
messagebirdtest.WillReturn(lookupHLRObject, http.StatusOK)
9595
client := messagebirdtest.Client(t)
9696

97-
hlr, err := ReadHLR(client, "31624971134", &LookupParams{CountryCode: "NL"})
97+
hlr, err := ReadHLR(client, "31624971134", &Params{CountryCode: "NL"})
9898
if err != nil {
9999
t.Fatalf("Didn't expect error while doing the lookup: %s", err)
100100
}
101101
checkHLR(t, hlr)
102102
}
103103

104104
func TestRequestDataForLookupHLR(t *testing.T) {
105-
lookupParams := &LookupParams{
105+
lookupParams := &Params{
106106
CountryCode: "NL",
107107
Reference: "MyReference",
108108
}
@@ -120,7 +120,7 @@ func TestCreateHLR(t *testing.T) {
120120
messagebirdtest.WillReturn(lookupHLRObject, http.StatusCreated)
121121
client := messagebirdtest.Client(t)
122122

123-
hlr, err := CreateHLR(client, "31624971134", &LookupParams{CountryCode: "NL", Reference: "reference2000"})
123+
hlr, err := CreateHLR(client, "31624971134", &Params{CountryCode: "NL", Reference: "reference2000"})
124124
if err != nil {
125125
t.Fatalf("Didn't expect error while doing the lookup: %s", err)
126126
}

message/message.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ type MessageList struct {
4444
Items []Message
4545
}
4646

47-
// MessageParams provide additional message send options and used in URL as params.
48-
type MessageParams struct {
47+
// Params provide additional message send options and used in URL as params.
48+
type Params struct {
4949
Type string
5050
Reference string
5151
Validity int
@@ -56,8 +56,8 @@ type MessageParams struct {
5656
ScheduledDatetime time.Time
5757
}
5858

59-
// MessageListParams provides additional message list options.
60-
type MessageListParams struct {
59+
// ListParams provides additional message list options.
60+
type ListParams struct {
6161
Originator string
6262
Direction string
6363
Type string
@@ -94,7 +94,7 @@ func Read(c *messagebird.Client, id string) (*Message, error) {
9494
}
9595

9696
// List retrieves all messages of the user represented as a MessageList object.
97-
func List(c *messagebird.Client, msgListParams *MessageListParams) (*MessageList, error) {
97+
func List(c *messagebird.Client, msgListParams *ListParams) (*MessageList, error) {
9898
messageList := &MessageList{}
9999
params, err := paramsForMessageList(msgListParams)
100100
if err != nil {
@@ -109,7 +109,7 @@ func List(c *messagebird.Client, msgListParams *MessageListParams) (*MessageList
109109
}
110110

111111
// Create creates a new message for one or more recipients.
112-
func Create(c *messagebird.Client, originator string, recipients []string, body string, msgParams *MessageParams) (*Message, error) {
112+
func Create(c *messagebird.Client, originator string, recipients []string, body string, msgParams *Params) (*Message, error) {
113113
requestData, err := requestDataForMessage(originator, recipients, body, msgParams)
114114
if err != nil {
115115
return nil, err
@@ -123,7 +123,7 @@ func Create(c *messagebird.Client, originator string, recipients []string, body
123123
return message, nil
124124
}
125125

126-
func requestDataForMessage(originator string, recipients []string, body string, params *MessageParams) (*messageRequest, error) {
126+
func requestDataForMessage(originator string, recipients []string, body string, params *Params) (*messageRequest, error) {
127127
if originator == "" {
128128
return nil, errors.New("originator is required")
129129
}
@@ -167,7 +167,7 @@ func requestDataForMessage(originator string, recipients []string, body string,
167167

168168
// paramsForMessageList converts the specified MessageListParams struct to a
169169
// url.Values pointer and returns it.
170-
func paramsForMessageList(params *MessageListParams) (*url.Values, error) {
170+
func paramsForMessageList(params *ListParams) (*url.Values, error) {
171171
urlParams := &url.Values{}
172172

173173
if params == nil {

message/message_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ func TestCreateWithParams(t *testing.T) {
394394
messagebirdtest.WillReturn(messageWithParamsObject, http.StatusOK)
395395
client := messagebirdtest.Client(t)
396396

397-
params := &MessageParams{
397+
params := &Params{
398398
Type: "sms",
399399
Reference: "TestReference",
400400
Validity: 13,
@@ -432,7 +432,7 @@ func TestCreateWithBinaryType(t *testing.T) {
432432
messagebirdtest.WillReturn(binaryMessageObject, http.StatusOK)
433433
client := messagebirdtest.Client(t)
434434

435-
params := &MessageParams{
435+
params := &Params{
436436
Type: "binary",
437437
TypeDetails: TypeDetails{"udh": "050003340201"},
438438
}
@@ -459,7 +459,7 @@ func TestCreateWithPremiumType(t *testing.T) {
459459
messagebirdtest.WillReturn(premiumMessageObject, http.StatusOK)
460460
client := messagebirdtest.Client(t)
461461

462-
params := &MessageParams{
462+
params := &Params{
463463
Type: "premium",
464464
TypeDetails: TypeDetails{"keyword": "RESTAPI", "shortcode": 1008, "tariff": 150},
465465
}
@@ -494,7 +494,7 @@ func TestCreateWithFlashType(t *testing.T) {
494494
messagebirdtest.WillReturn(flashMessageObject, http.StatusOK)
495495
client := messagebirdtest.Client(t)
496496

497-
params := &MessageParams{Type: "flash"}
497+
params := &Params{Type: "flash"}
498498

499499
message, err := Create(client, "TestName", []string{"31612345678"}, "Hello World", params)
500500
if err != nil {
@@ -512,7 +512,7 @@ func TestCreateWithScheduledDatetime(t *testing.T) {
512512

513513
scheduledDatetime, _ := time.Parse(time.RFC3339, "2015-01-05T10:03:59+00:00")
514514

515-
params := &MessageParams{ScheduledDatetime: scheduledDatetime}
515+
params := &Params{ScheduledDatetime: scheduledDatetime}
516516

517517
message, err := Create(client, "TestName", []string{"31612345678"}, "Hello World", params)
518518
if err != nil {
@@ -573,7 +573,7 @@ func TestList(t *testing.T) {
573573

574574
func TestRequestDataForMessage(t *testing.T) {
575575
currentTime := time.Now()
576-
messageParams := &MessageParams{
576+
messageParams := &Params{
577577
Type: "binary",
578578
Reference: "MyReference",
579579
Validity: 1,

mmsmessage/mms_message.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ type MMSMessage struct {
2525
Recipients messagebird.Recipients
2626
}
2727

28-
// MMSMessageParams represents the parameters that can be supplied when creating
28+
// Params represents the parameters that can be supplied when creating
2929
// a request.
30-
type MMSMessageParams struct {
30+
type Params struct {
3131
Body string
3232
MediaUrls []string
3333
Subject string
@@ -49,7 +49,7 @@ func Read(c *messagebird.Client, id string) (*MMSMessage, error) {
4949
}
5050

5151
// Create creates a new MMS message for one or more recipients.
52-
func Create(c *messagebird.Client, originator string, recipients []string, msgParams *MMSMessageParams) (*MMSMessage, error) {
52+
func Create(c *messagebird.Client, originator string, recipients []string, msgParams *Params) (*MMSMessage, error) {
5353
params, err := paramsForMMSMessage(msgParams)
5454
if err != nil {
5555
return nil, err
@@ -68,7 +68,7 @@ func Create(c *messagebird.Client, originator string, recipients []string, msgPa
6868

6969
// paramsForMMSMessage converts the specified MMSMessageParams struct to a
7070
// url.Values pointer and returns it.
71-
func paramsForMMSMessage(params *MMSMessageParams) (*url.Values, error) {
71+
func paramsForMMSMessage(params *Params) (*url.Values, error) {
7272
urlParams := &url.Values{}
7373

7474
if params.Body == "" && params.MediaUrls == nil {

mmsmessage/mms_message_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func TestCreate(t *testing.T) {
4646
messagebirdtest.WillReturn(mmsMessageObject, http.StatusOK)
4747
client := messagebirdtest.Client(t)
4848

49-
params := &MMSMessageParams{
49+
params := &Params{
5050
Body: "Hello World",
5151
MediaUrls: []string{"http://w3.org/1.gif", "http://w3.org/2.gif"},
5252
Subject: "TestSubject",
@@ -118,7 +118,7 @@ func TestCreateError(t *testing.T) {
118118
messagebirdtest.WillReturnAccessKeyError()
119119
client := messagebirdtest.Client(t)
120120

121-
params := &MMSMessageParams{
121+
params := &Params{
122122
Body: "Hello World",
123123
MediaUrls: nil,
124124
Subject: "",
@@ -149,7 +149,7 @@ func TestCreateError(t *testing.T) {
149149
func TestCreateWithEmptyParams(t *testing.T) {
150150
client := messagebirdtest.Client(t)
151151

152-
params := &MMSMessageParams{
152+
params := &Params{
153153
Body: "",
154154
MediaUrls: nil,
155155
Subject: "",

verify/verify.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ type Verify struct {
2121
Recipient int
2222
}
2323

24-
// VerifyParams handles optional verification parameters.
25-
type VerifyParams struct {
24+
// Params handles optional verification parameters.
25+
type Params struct {
2626
Originator string
2727
Reference string
2828
Type string
@@ -53,7 +53,7 @@ type verifyRequest struct {
5353
const path = "verify"
5454

5555
// Create generates a new One-Time-Password for one recipient.
56-
func Create(c *messagebird.Client, recipient string, params *VerifyParams) (*Verify, error) {
56+
func Create(c *messagebird.Client, recipient string, params *Params) (*Verify, error) {
5757
requestData, err := requestDataForVerify(recipient, params)
5858
if err != nil {
5959
return nil, err
@@ -82,7 +82,7 @@ func VerifyToken(c *messagebird.Client, id, token string) (*Verify, error) {
8282
return verify, nil
8383
}
8484

85-
func requestDataForVerify(recipient string, params *VerifyParams) (*verifyRequest, error) {
85+
func requestDataForVerify(recipient string, params *Params) (*verifyRequest, error) {
8686
if recipient == "" {
8787
return nil, errors.New("recipient is required")
8888
}

verify/verify_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ func assertVerifyTokenObject(t *testing.T, v *Verify) {
147147
}
148148

149149
func TestRequestDataForVerify(t *testing.T) {
150-
verifyParams := &VerifyParams{
150+
verifyParams := &Params{
151151
Originator: "MSGBIRD",
152152
Reference: "MyReference",
153153
Type: "sms",

voicemessage/voice_message.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ type VoiceMessageList struct {
3535
Items []VoiceMessage
3636
}
3737

38-
// VoiceMessageParams struct provides additional VoiceMessage details.
39-
type VoiceMessageParams struct {
38+
// Params struct provides additional VoiceMessage details.
39+
type Params struct {
4040
Originator string
4141
Reference string
4242
Language string
@@ -82,7 +82,7 @@ func List(c *messagebird.Client) (*VoiceMessageList, error) {
8282
}
8383

8484
// Create a new voice message for one or more recipients.
85-
func Create(c *messagebird.Client, recipients []string, body string, params *VoiceMessageParams) (*VoiceMessage, error) {
85+
func Create(c *messagebird.Client, recipients []string, body string, params *Params) (*VoiceMessage, error) {
8686
requestData, err := requestDataForVoiceMessage(recipients, body, params)
8787
if err != nil {
8888
return nil, err
@@ -96,7 +96,7 @@ func Create(c *messagebird.Client, recipients []string, body string, params *Voi
9696
return message, nil
9797
}
9898

99-
func requestDataForVoiceMessage(recipients []string, body string, params *VoiceMessageParams) (*voiceMessageRequest, error) {
99+
func requestDataForVoiceMessage(recipients []string, body string, params *Params) (*voiceMessageRequest, error) {
100100
if len(recipients) == 0 {
101101
return nil, errors.New("at least 1 recipient is required")
102102
}

voicemessage/voice_message_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ func TestCreateWithParams(t *testing.T) {
245245
messagebirdtest.WillReturn(voiceMessageObjectWithParams, http.StatusOK)
246246
client := messagebirdtest.Client(t)
247247

248-
params := &VoiceMessageParams{
248+
params := &Params{
249249
Reference: "MyReference",
250250
Voice: "male",
251251
Repeat: 5,
@@ -280,7 +280,7 @@ func TestCreateWithScheduledDatetime(t *testing.T) {
280280

281281
scheduledDatetime, _ := time.Parse(time.RFC3339, "2015-01-05T16:12:24+00:00")
282282

283-
params := &VoiceMessageParams{ScheduledDatetime: scheduledDatetime}
283+
params := &Params{ScheduledDatetime: scheduledDatetime}
284284

285285
message, err := Create(client, []string{"31612345678"}, "Hello World", params)
286286
if err != nil {
@@ -337,7 +337,7 @@ func TestList(t *testing.T) {
337337

338338
func TestRequestDataForVoiceMessage(t *testing.T) {
339339
currentTime := time.Now()
340-
voiceParams := &VoiceMessageParams{
340+
voiceParams := &Params{
341341
Originator: "MSGBIRD",
342342
Reference: "MyReference",
343343
Language: "en-gb",

0 commit comments

Comments
 (0)