Skip to content

Commit

Permalink
Update types.
Browse files Browse the repository at this point in the history
  • Loading branch information
onrik committed Oct 18, 2019
1 parent 8c2dd0c commit 6fd5c35
Show file tree
Hide file tree
Showing 8 changed files with 410 additions and 221 deletions.
14 changes: 12 additions & 2 deletions bot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -848,11 +848,21 @@ func (s *BotTestSuite) TestGetGameHighScorese() {
s.Equal(len(scores), 2)
s.Equal(scores[0].Position, 1)
s.Equal(scores[0].Score, 22)
s.Equal(scores[0].User, User{456, "John", "Doe", "john_doe", ""})
s.Equal(scores[0].User, User{
ID: 456,
FirstName: "John",
LastName: "Doe",
Username: "john_doe",
})

s.Equal(scores[1].Position, 2)
s.Equal(scores[1].Score, 11)
s.Equal(scores[1].User, User{789, "Mohammad", "Li", "mli", ""})
s.Equal(scores[1].User, User{
ID: 789,
FirstName: "Mohammad",
LastName: "Li",
Username: "mli",
})

}

Expand Down
5 changes: 5 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
module github.com/onrik/micha

go 1.13

require (
github.com/jarcoal/httpmock v1.0.4
github.com/stretchr/testify v1.4.0
)
41 changes: 28 additions & 13 deletions options.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,36 +39,42 @@ func WithHttpClient(httpClient HttpClient) Option {
}
}

// Send message optional params
// SendMessageOptions optional params SendMessage method
type SendMessageOptions struct {
DisableNotification bool `json:"disable_notification,omitempty"`
ReplyToMessageID int64 `json:"reply_to_message_id,omitempty"`
ParseMode ParseMode `json:"parse_mode,omitempty"`
DisableWebPagePreview bool `json:"disable_web_page_preview,omitempty"`
DisableNotification bool `json:"disable_notification,omitempty"`
ReplyToMessageID int64 `json:"reply_to_message_id,omitempty"`
ReplyMarkup ReplyMarkup `json:"reply_markup,omitempty"`
}

// Send photo optional params
// SendPhotoOptions optional params SendPhoto method
type SendPhotoOptions struct {
Caption string `json:"caption,omitempty"`
ParseMode ParseMode `json:"parse_mode,omitempty"`
DisableNotification bool `json:"disable_notification,omitempty"`
ReplyToMessageID int64 `json:"reply_to_message_id,omitempty"`
ReplyMarkup ReplyMarkup `json:"reply_markup,omitempty"`
}

// Send audio optional params
// SendAudioOptions optional params SendAudio method
type SendAudioOptions struct {
Caption string `json:"caption,omitempty"`
ParseMode ParseMode `json:"parse_mode,omitempty"`
Duration int `json:"duration,omitempty"`
Performer string `json:"performer,omitempty"`
Title string `json:"title,omitempty"`
Thumb string `json:"thumb,omitempty"` // TODO add thumb as file
DisableNotification bool `json:"disable_notification,omitempty"`
ReplyToMessageID int64 `json:"reply_to_message_id,omitempty"`
ReplyMarkup ReplyMarkup `json:"reply_markup,omitempty"`
}

// Send document optional params
// SendDocumentOptions optional params SendDocument method
type SendDocumentOptions struct {
Thumb string `json:"thumb,omitempty"` // TODO add thumb as file
Caption string `json:"caption,omitempty"`
ParseMode ParseMode `json:"parse_mode,omitempty"`
DisableNotification bool `json:"disable_notification,omitempty"`
ReplyToMessageID int64 `json:"reply_to_message_id,omitempty"`
ReplyMarkup ReplyMarkup `json:"reply_markup,omitempty"`
Expand All @@ -81,57 +87,66 @@ type SendStickerOptions struct {
ReplyMarkup ReplyMarkup `json:"reply_markup,omitempty"`
}

// Send video optional params
// SendVideoOptions video optional params SendVideo method
type SendVideoOptions struct {
Duration int `json:"duration,omitempty"`
Width int `json:"width,omitempty"`
Height int `json:"height,omitempty"`
Thumb string `json:"thumb,omitempty"` // TODO add thumb as file
Caption string `json:"caption,omitempty"`
ParseMode ParseMode `json:"parse_mode,omitempty"`
SupportsStreaming bool `json:"supports_streaming,omitempty"`
DisableNotification bool `json:"disable_notification,omitempty"`
ReplyToMessageID int64 `json:"reply_to_message_id,omitempty"`
ReplyMarkup ReplyMarkup `json:"reply_markup,omitempty"`
}

// Send voice optional params
// SendVoiceOptions optional params for SendVoice method
type SendVoiceOptions struct {
Caption string `json:"caption,omitempty"`
ParseMode ParseMode `json:"parse_mode,omitempty"`
Duration int `json:"duration,omitempty"`
DisableNotification bool `json:"disable_notification,omitempty"`
ReplyToMessageID int64 `json:"reply_to_message_id,omitempty"`
ReplyMarkup ReplyMarkup `json:"reply_markup,omitempty"`
}

// Send video note optional params
// SendVideoNoteOptions optional params for SendVideoNote method
type SendVideoNoteOptions struct {
Duration int `json:"duration,omitempty"`
Length int `json:"length,omitempty"`
Thumb string `json:"thumb,omitempty"` // TODO add thumb as file
DisableNotification bool `json:"disable_notification,omitempty"`
ReplyToMessageID int64 `json:"reply_to_message_id,omitempty"`
ReplyMarkup ReplyMarkup `json:"reply_markup,omitempty"`
}

// Send location optional params
// SendLocationOptions optional params for SendLocation method
type SendLocationOptions struct {
LivePeriod int `json:"live_period,omitempty"`
DisableNotification bool `json:"disable_notification,omitempty"`
ReplyToMessageID int64 `json:"reply_to_message_id,omitempty"`
ReplyMarkup ReplyMarkup `json:"reply_markup,omitempty"`
}

// Send venue optional params
// SendVenueOptions optional params for SendVenue method
type SendVenueOptions struct {
FoursquareID string `json:"foursquare_id,omitempty"`
FoursquareType string `json:"foursquare_type,omitempty"`
DisableNotification bool `json:"disable_notification,omitempty"`
ReplyToMessageID int64 `json:"reply_to_message_id,omitempty"`
ReplyMarkup ReplyMarkup `json:"reply_markup,omitempty"`
}

// Send contact optional params
// SendContactOptions optional params for SendContact method
type SendContactOptions struct {
VCard string `json:"vcard,omitempty"`
DisableNotification bool `json:"disable_notification,omitempty"`
ReplyToMessageID int64 `json:"reply_to_message_id,omitempty"`
ReplyMarkup ReplyMarkup `json:"reply_markup,omitempty"`
}

// Send game optional params
// SendGameOptions optional params for SendGame method
type SendGameOptions struct {
DisableNotification bool `json:"disable_notification,omitempty"`
ReplyToMessageID int64 `json:"reply_to_message_id,omitempty"`
Expand Down
Loading

0 comments on commit 6fd5c35

Please sign in to comment.