I just released RESTMessage_MTC, a REST client framework. It’s open-source, free to use, and you can find it here.
From the detailed project README:
The harness project contains examples to give you an idea of how you’d use this in your own code.
I just released RESTMessage_MTC, a REST client framework. It’s open-source, free to use, and you can find it here.
From the detailed project README:
The harness project contains examples to give you an idea of how you’d use this in your own code.
I just updated the project to v.1.1. From the release notes:
The purpose of the surrogate is to let you send multiple copies of the same message simultaneously without having to set up and tear down handlers for the events. I’ve modified the Eddies Electronics examples to demonstrate.
Hi Kem
Thanks for your efforts with the RestClient
I get a type mismatch when passing value as Auto(3)
to dim objectDict as Xojo.Core.Dictionary = value
[code]Private Function Deserialize(value As Auto, intoProp As Xojo.Introspection.PropertyInfo, currentValue As Auto) As Auto
dim tiDestination as Xojo.Introspection.TypeInfo = intoProp.PropertyType
dim typeName as text = tiDestination.Name
if typeName.Length > 2 and typeName.EndsWith( “()” ) then
return DeserializeArray( value, intoProp, currentValue )
elseif IsIntrinsicType( typeName ) then
return value
else
dim objectDict as Xojo.Core.Dictionary = value
return DeserializeObject( objectDict, intoProp )
end if
End Function[/code]
I’m on vacation this week so I won’t be able to look for a while, but take a look at the develop branch of the project. It includes a number of fixes that have not yet been merged into master.
Enjoy your vacation.
Hi Kem,
Finally getting back to this.
With the dev branch I get farther but it fails at
return DeserializeDictionary( value, intoProp )
When trying to process Auto(0)
[code]Private Function DeserializeObject(value As Auto, intoProp As Xojo.Introspection.PropertyInfo, objectTypeInfo As Xojo.Introspection.TypeInfo = Nil) As Object
if value = nil then
return nil
end if
dim tiObject as Xojo.Introspection.TypeInfo = if( objectTypeInfo is nil, intoProp.PropertyType, objectTypeInfo )
dim typeName as text = tiObject.Name
select case typeName.Replace( “()”, “” )
case “Dictionary”, “Xojo.Core.Dictionary”
return DeserializeDictionary( value, intoProp )
case “Date”, “Xojo.Core.Date”
return DeserializeDate( value, intoProp )
case else
//
// Have to create a new object to return
//
dim c as Xojo.Introspection.ConstructorInfo = GetZeroParamConstructor( tiObject )
if c isa object then
dim o as object = c.Invoke
//
// Create a dictionary of the object's properties
//
dim propsDict as new Xojo.Core.Dictionary
for each prop as Xojo.Introspection.PropertyInfo in tiObject.Properties
if prop.CanWrite and prop.IsPublic and not prop.IsShared then
propsDict.Value( prop.Name ) = prop
end if
next prop
if propsDict.Count <> 0 then
JSONObjectToProps( value, propsDict, "", o )
end if
return o
end if
end select
End Function[/code]
Introspection is good stuff
It will be a while before I can look, but it will help if you can submit a unit test to the project that shows the issue.
How to access the Familysearch API with these class? Sandbox-URL: https://sandbox.familysearch.org and your username and password of your Familysearch Developer Account.
[h]Obtain Access Token with Username and Password[/h]
This example request illustrates how to obtain an access token using a user’s username and password. Note that this mechanism is available only to approved developer keys.
Request
[code]POST /cis-web/oauth2/v3/token
Accept: application/json
Content-Type: application/x-www-form-urlencoded
username=kbear23&grant_type=password&client_id=PHNQ-DY47-PDAG-8NB9-XJD7-JE4J-R0W5-NK3P&password=WhereIsPapa%3F[/code]
Response
[code]HTTP/1.1 200 OK
Transfer-encoding: chunked
Cache-control: no-cache, no-store, no-transform, must-revalidate, max-age=0
Vary: Accept-Encoding
Vary: Accept, Accept-Language, Accept-Encoding, Expect
Date: Thu, 04 Aug 2016 20:47:44 GMT
Content-type: application/json
X-processing-time: 1
{
“access_token” : “2YoTnFdFEjr1zCsicMWpAA”,
“token_type” : “family_search”
}[/code]
Could you please give a small example? Maybe how to search for Person into a Xojo App?
https://familysearch.org/developers/docs/api/tree/Search_Persons_usecase
Thanks
Not sure if this is exactly what you need, but it sounds like I’d:
HTH.
Thanks Kem, i try this
[quote=265604:@Kem Tekinay]I just released RESTMessage_MTC, a REST client framework. It’s open-source, free to use, and you can find it here.
From the detailed project README:
The harness project contains examples to give you an idea of how you’d use this in your own code.[/quote]
powerfull