-
Notifications
You must be signed in to change notification settings - Fork 0
/
inline_query_result_venue.go
executable file
·73 lines (69 loc) · 3.44 KB
/
inline_query_result_venue.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// Code AutoGenerated; DO NOT EDIT.
package types
import (
"encoding/json"
"fmt"
)
// InlineQueryResultVenue Represents a venue
// By default, the venue will be sent by the user
// Alternatively, you can use input_message_content to send a message with the specified content instead of the venue.
type InlineQueryResultVenue struct {
Address string `json:"address"`
FoursquareID string `json:"foursquare_id,omitempty"`
FoursquareType string `json:"foursquare_type,omitempty"`
GooglePlaceID string `json:"google_place_id,omitempty"`
GooglePlaceType string `json:"google_place_type,omitempty"`
ID string `json:"id"`
InputMessageContent any `json:"input_message_content,omitempty"`
Latitude float64 `json:"latitude"`
Longitude float64 `json:"longitude"`
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
ThumbnailHeight int `json:"thumbnail_height,omitempty"`
ThumbnailURL string `json:"thumbnail_url,omitempty"`
ThumbnailWidth int64 `json:"thumbnail_width,omitempty"`
Title string `json:"title"`
}
func (entity InlineQueryResultVenue) MarshalJSON() ([]byte, error) {
alias := struct {
Type string `json:"type"`
ID string `json:"id"`
Latitude float64 `json:"latitude"`
Longitude float64 `json:"longitude"`
Title string `json:"title"`
Address string `json:"address"`
FoursquareID string `json:"foursquare_id,omitempty"`
FoursquareType string `json:"foursquare_type,omitempty"`
GooglePlaceID string `json:"google_place_id,omitempty"`
GooglePlaceType string `json:"google_place_type,omitempty"`
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
InputMessageContent any `json:"input_message_content,omitempty"`
ThumbnailURL string `json:"thumbnail_url,omitempty"`
ThumbnailWidth int64 `json:"thumbnail_width,omitempty"`
ThumbnailHeight int `json:"thumbnail_height,omitempty"`
}{
Type: "venue",
ID: entity.ID,
Latitude: entity.Latitude,
Longitude: entity.Longitude,
Title: entity.Title,
Address: entity.Address,
FoursquareID: entity.FoursquareID,
FoursquareType: entity.FoursquareType,
GooglePlaceID: entity.GooglePlaceID,
GooglePlaceType: entity.GooglePlaceType,
ReplyMarkup: entity.ReplyMarkup,
InputMessageContent: entity.InputMessageContent,
ThumbnailURL: entity.ThumbnailURL,
ThumbnailWidth: entity.ThumbnailWidth,
ThumbnailHeight: entity.ThumbnailHeight,
}
if entity.InputMessageContent != nil {
switch entity.InputMessageContent.(type) {
case InputTextMessageContent, InputLocationMessageContent, InputVenueMessageContent, InputContactMessageContent, InputInvoiceMessageContent:
break
default:
return nil, fmt.Errorf("input_message_content: unknown type: %T", entity.InputMessageContent)
}
}
return json.Marshal(alias)
}