FamilySearch / gedcomx-csharp

C# Libraries for GEDCOM X Processing
Apache License 2.0
41 stars 21 forks source link

FS Gedcomx property and data loading #41

Open weitzhandler opened 7 years ago

weitzhandler commented 7 years ago

Hi,

I am new to the API and I was wondering whether all the classes in the API (let's say PersonState) store genealogy info (in properties), or are just a means for request data, but not to be used as entity classes.

It's just that I still didn't manage to load current user as a person record along with its birth date and some other conclusions.

Here's my code:

var uri = new Uri("https://integration.familysearch.org/platform/collections/tree");
var tree = new FamilySearchFamilyTree(uri);
var state = tree.AuthenticateViaOAuth2Password(Username, Password, ClientId);

Debug.Assert(state.IsAuthenticated);
var current = tree.ReadPersonForCurrentUser();
var name = current.GetName(); //null
var conclusion = current.GetConclusion(); //null
var conclusions = current.LoadConclusions();

Now my question is what's next? Why is the name and conclusion field null, if the tree looks like so:

Here's a screenshot of what I see in my debugger for the variable conclusions:

wooddani commented 7 years ago

The full api has both properties and links that act as references to future api calls. Please check out the unit test project. In my learning that proved to be the easiest way to understand how the data is organised.

On Mon, Jan 23, 2017 at 1:57 AM, Shimmy notifications@github.com wrote:

Hi,

I am new to the API and I was wondering whether all the classes in the API (let's say PersonState) store genealogy info (in properties), or are just a means for request data, but not to be used as entity classes.

It's just that I still didn't manage to load current user as a person record along with its birth date and some other conclusions.

Here's my code:

var uri = new Uri("https://integration.familysearch.org/platform/collections/tree"); var tree = new FamilySearchFamilyTree(uri); var state = tree.AuthenticateViaOAuth2Password(Username, Password, ClientId);

Debug.Assert(state.IsAuthenticated); var current = tree.ReadPersonForCurrentUser(); var name = current.GetName(); //null var conclusion = current.GetConclusion(); //null var conclusions = current.LoadConclusions();

Now my question is what's next? Why is the name and conclusion field null, if the tree looks like so:

https://camo.githubusercontent.com/6eb3d7b09d3c1157259a801bfa531d426f02d8ca/687474703a2f2f692e696d6775722e636f6d2f645a586f6d50302e706e67

Here's a screenshot of what I see in my debugger for the variable conclusions:

https://camo.githubusercontent.com/a015c38f03cbde7b03510de40ceff5a3c7781f54/687474703a2f2f692e696d6775722e636f6d2f396d5a453053382e706e67

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/FamilySearch/gedcomx-csharp/issues/41, or mute the thread https://github.com/notifications/unsubscribe-auth/APgcp6z4GpUgaz8uKvlP95H1iy2l9jlRks5rVGtigaJpZM4LqyxV .

weitzhandler commented 7 years ago

Hi, After some digging into the examples, I admit I should have done it earlier. I now learned that the SDK uses fluent API style to construct things. Anyway, my question still remains, how do I get from a PersonState to a Person. Considering my code above why does this evaluate to null:

var uri = new Uri("https://integration.familysearch.org/platform/collections/tree");
var tree = new FamilySearchFamilyTree(uri);
var state = tree.AuthenticateViaOAuth2Password(Username, Password, ClientId);
Debug.Assert(state.IsAuthenticated);
var current = tree.ReadPersonForCurrentUser();
var person = current.Person; //null
stoicflame commented 7 years ago

There must have been some kind of error, or the SDK didn't correctly follow the redirect.

weitzhandler commented 7 years ago

Can you help me trace the problem?