1
+ package com.pengrad.telegrambot.request
2
+
3
+ import com.pengrad.telegrambot.utility.kotlin.checkDeprecatedConstructorParameters
4
+ import com.pengrad.telegrambot.utility.kotlin.optionalRequestParameter
5
+ import com.pengrad.telegrambot.utility.kotlin.requestParameter
6
+
7
+ class SendVenue private constructor(
8
+ chatId : Long? = null ,
9
+ channelUsername : String? = null ,
10
+
11
+ latitude : Float ,
12
+ longitude : Float ,
13
+ title : String ,
14
+ address : String
15
+ ) : KAbstractSendRequest<SendVenue>(
16
+ chatId = chatId,
17
+ channelUsername = channelUsername,
18
+ ) {
19
+
20
+ constructor (
21
+ chatId: Long ,
22
+ latitude: Float ,
23
+ longitude: Float ,
24
+ title: String ,
25
+ address: String
26
+ ) : this (
27
+ chatId = chatId,
28
+ channelUsername = null ,
29
+ latitude = latitude,
30
+ longitude = longitude,
31
+ title = title,
32
+ address = address
33
+ )
34
+
35
+ constructor (
36
+ channelUsername: String ,
37
+ latitude: Float ,
38
+ longitude: Float ,
39
+ title: String ,
40
+ address: String
41
+ ) : this (
42
+ chatId = null ,
43
+ channelUsername = channelUsername,
44
+ latitude = latitude,
45
+ longitude = longitude,
46
+ title = title,
47
+ address = address
48
+ )
49
+
50
+ @Deprecated(" Use constructor with chatId or channelUsername instead" , ReplaceWith (" SendVenue(chatId, latitude, longitude, title, address)" ))
51
+ constructor (
52
+ chatId: Any ,
53
+ latitude: Float ,
54
+ longitude: Float ,
55
+ title: String ,
56
+ address: String
57
+ ) : this (
58
+ chatId = (chatId as ? Number )?.toLong(),
59
+ channelUsername = chatId as ? String ,
60
+ latitude = latitude,
61
+ longitude = longitude,
62
+ title = title,
63
+ address = address
64
+ ) {
65
+ checkDeprecatedConstructorParameters()
66
+ }
67
+
68
+ val latitude: Float by requestParameter(latitude)
69
+ val longitude: Float by requestParameter(longitude)
70
+ val title: String by requestParameter(title)
71
+ val address: String by requestParameter(address)
72
+
73
+ var foursquareId: String? by optionalRequestParameter()
74
+ var foursquareType: String? by optionalRequestParameter()
75
+
76
+ var googlePlaceId: String? by optionalRequestParameter()
77
+ var googlePlaceType: String? by optionalRequestParameter()
78
+
79
+ fun foursquareId (foursquareId : String ) = applySelf { this .foursquareId = foursquareId }
80
+
81
+ fun foursquareType (foursquareType : String ) = applySelf { this .foursquareType = foursquareType }
82
+
83
+ fun googlePlaceId (googlePlaceId : String ) = applySelf { this .googlePlaceId = googlePlaceId }
84
+
85
+ fun googlePlaceType (googlePlaceType : String ) = applySelf { this .googlePlaceType = googlePlaceType }
86
+
87
+ }
0 commit comments