Hello all ,
I am trying/planning to make a B4X version of Telegram bots Api by accessing the REST API but I am not sure I am doing it the right way ?
For example , I am using custom types for telegram types like this
The problem is in casting as the result in a json string , I am writing every item like
Should I go ahead and do all other types and functions in this way or do you guys have better suggestions/solutions ?
Regards
I am trying/planning to make a B4X version of Telegram bots Api by accessing the REST API but I am not sure I am doing it the right way ?
For example , I am using custom types for telegram types like this
B4X:
Type User (id As Int,is_bot As Boolean,first_name As String,last_name As String,username As String,language_code As String)
The problem is in casting as the result in a json string , I am writing every item like
B4X:
Case "GetMe"
Dim u As User
u.Initialize
Dim jn As JSONParser
jn.Initialize(job.GetString)
Dim umap As Map = jn.NextObject.Get("result")
u.first_name = umap.Get("first_name")
u.is_bot = umap.Get("is_bot")
u.id = umap.Get("id")
u.username = umap.Get("username")
u.last_name=umap.Get("last_name")
u.language_code=umap.Get("language_code")
If SubExists(callbac,evname&"_me") Then
CallSub2(Main,evname&"_me",u)
End If
Should I go ahead and do all other types and functions in this way or do you guys have better suggestions/solutions ?
Regards