├── .gitignore
├── Example1
├── App.config
├── Example1.csproj
├── Program.cs
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── TestBacking.cs
└── packages.config
├── Example2.Core
├── Example2.Core.xproj
├── Program.cs
├── Properties
│ └── AssemblyInfo.cs
└── project.json
├── Gedcomx.Api.Lite.Core
├── Environment.cs
├── FamilySearchSDK.cs
├── Gedcomx.Api.Lite.Core.nuspec
├── Gedcomx.Api.Lite.Core.xproj
├── MediaType.cs
├── Properties
│ ├── AssemblyInfo.cs
│ └── launchSettings.json
└── project.json
├── Gedcomx.Api.Lite.Tests
├── AuthenticationTests.cs
├── Gedcomx.Api.Lite.Tests.csproj
├── PersonTests.cs
├── PortraitTests.cs
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── TestBacking.cs
├── app.config
└── packages.config
├── Gedcomx.Api.Lite.sln
├── Gedcomx.Api.Lite
├── Gedcomx.Api.Lite.csproj
├── Gedcomx.Api.Lite.nuspec
├── Properties
│ └── AssemblyInfo.cs
└── packages.config
└── README.md
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # User-specific files
5 | *.suo
6 | *.user
7 | *.userosscache
8 | *.sln.docstates
9 |
10 | # User-specific files (MonoDevelop/Xamarin Studio)
11 | *.userprefs
12 |
13 | # Build results
14 | [Dd]ebug/
15 | [Dd]ebugPublic/
16 | [Rr]elease/
17 | [Rr]eleases/
18 | x64/
19 | x86/
20 | bld/
21 | [Bb]in/
22 | [Oo]bj/
23 | [Ll]og/
24 |
25 | # Visual Studio 2015 cache/options directory
26 | .vs/
27 | # Uncomment if you have tasks that create the project's static files in wwwroot
28 | #wwwroot/
29 |
30 | # MSTest test Results
31 | [Tt]est[Rr]esult*/
32 | [Bb]uild[Ll]og.*
33 |
34 | # NUNIT
35 | *.VisualState.xml
36 | TestResult.xml
37 |
38 | # Build Results of an ATL Project
39 | [Dd]ebugPS/
40 | [Rr]eleasePS/
41 | dlldata.c
42 |
43 | # DNX
44 | project.lock.json
45 | artifacts/
46 |
47 | *_i.c
48 | *_p.c
49 | *_i.h
50 | *.ilk
51 | *.meta
52 | *.obj
53 | *.pch
54 | *.pdb
55 | *.pgc
56 | *.pgd
57 | *.rsp
58 | *.sbr
59 | *.tlb
60 | *.tli
61 | *.tlh
62 | *.tmp
63 | *.tmp_proj
64 | *.log
65 | *.vspscc
66 | *.vssscc
67 | .builds
68 | *.pidb
69 | *.svclog
70 | *.scc
71 |
72 | # Chutzpah Test files
73 | _Chutzpah*
74 |
75 | # Visual C++ cache files
76 | ipch/
77 | *.aps
78 | *.ncb
79 | *.opendb
80 | *.opensdf
81 | *.sdf
82 | *.cachefile
83 | *.VC.db
84 | *.VC.VC.opendb
85 |
86 | # Visual Studio profiler
87 | *.psess
88 | *.vsp
89 | *.vspx
90 | *.sap
91 |
92 | # TFS 2012 Local Workspace
93 | $tf/
94 |
95 | # Guidance Automation Toolkit
96 | *.gpState
97 |
98 | # ReSharper is a .NET coding add-in
99 | _ReSharper*/
100 | *.[Rr]e[Ss]harper
101 | *.DotSettings.user
102 |
103 | # JustCode is a .NET coding add-in
104 | .JustCode
105 |
106 | # TeamCity is a build add-in
107 | _TeamCity*
108 |
109 | # DotCover is a Code Coverage Tool
110 | *.dotCover
111 |
112 | # NCrunch
113 | _NCrunch_*
114 | .*crunch*.local.xml
115 | nCrunchTemp_*
116 |
117 | # MightyMoose
118 | *.mm.*
119 | AutoTest.Net/
120 |
121 | # Web workbench (sass)
122 | .sass-cache/
123 |
124 | # Installshield output folder
125 | [Ee]xpress/
126 |
127 | # DocProject is a documentation generator add-in
128 | DocProject/buildhelp/
129 | DocProject/Help/*.HxT
130 | DocProject/Help/*.HxC
131 | DocProject/Help/*.hhc
132 | DocProject/Help/*.hhk
133 | DocProject/Help/*.hhp
134 | DocProject/Help/Html2
135 | DocProject/Help/html
136 |
137 | # Click-Once directory
138 | publish/
139 |
140 | # Publish Web Output
141 | *.[Pp]ublish.xml
142 | *.azurePubxml
143 | # TODO: Comment the next line if you want to checkin your web deploy settings
144 | # but database connection strings (with potential passwords) will be unencrypted
145 | *.pubxml
146 | *.publishproj
147 |
148 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
149 | # checkin your Azure Web App publish settings, but sensitive information contained
150 | # in these scripts will be unencrypted
151 | PublishScripts/
152 |
153 | # NuGet Packages
154 | *.nupkg
155 | # The packages folder can be ignored because of Package Restore
156 | **/packages/*
157 | # except build/, which is used as an MSBuild target.
158 | !**/packages/build/
159 | # Uncomment if necessary however generally it will be regenerated when needed
160 | #!**/packages/repositories.config
161 | # NuGet v3's project.json files produces more ignoreable files
162 | *.nuget.props
163 | *.nuget.targets
164 |
165 | # Microsoft Azure Build Output
166 | csx/
167 | *.build.csdef
168 |
169 | # Microsoft Azure Emulator
170 | ecf/
171 | rcf/
172 |
173 | # Windows Store app package directories and files
174 | AppPackages/
175 | BundleArtifacts/
176 | Package.StoreAssociation.xml
177 | _pkginfo.txt
178 |
179 | # Visual Studio cache files
180 | # files ending in .cache can be ignored
181 | *.[Cc]ache
182 | # but keep track of directories ending in .cache
183 | !*.[Cc]ache/
184 |
185 | # Others
186 | ClientBin/
187 | ~$*
188 | *~
189 | *.dbmdl
190 | *.dbproj.schemaview
191 | *.pfx
192 | *.publishsettings
193 | node_modules/
194 | orleans.codegen.cs
195 |
196 | # Since there are multiple workflows, uncomment next line to ignore bower_components
197 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
198 | #bower_components/
199 |
200 | # RIA/Silverlight projects
201 | Generated_Code/
202 |
203 | # Backup & report files from converting an old project file
204 | # to a newer Visual Studio version. Backup files are not needed,
205 | # because we have git ;-)
206 | _UpgradeReport_Files/
207 | Backup*/
208 | UpgradeLog*.XML
209 | UpgradeLog*.htm
210 |
211 | # SQL Server files
212 | *.mdf
213 | *.ldf
214 |
215 | # Business Intelligence projects
216 | *.rdl.data
217 | *.bim.layout
218 | *.bim_*.settings
219 |
220 | # Microsoft Fakes
221 | FakesAssemblies/
222 |
223 | # GhostDoc plugin setting file
224 | *.GhostDoc.xml
225 |
226 | # Node.js Tools for Visual Studio
227 | .ntvs_analysis.dat
228 |
229 | # Visual Studio 6 build log
230 | *.plg
231 |
232 | # Visual Studio 6 workspace options file
233 | *.opt
234 |
235 | # Visual Studio LightSwitch build output
236 | **/*.HTMLClient/GeneratedArtifacts
237 | **/*.DesktopClient/GeneratedArtifacts
238 | **/*.DesktopClient/ModelManifest.xml
239 | **/*.Server/GeneratedArtifacts
240 | **/*.Server/ModelManifest.xml
241 | _Pvt_Extensions
242 |
243 | # Paket dependency manager
244 | .paket/paket.exe
245 | paket-files/
246 |
247 | # FAKE - F# Make
248 | .fake/
249 |
250 | # JetBrains Rider
251 | .idea/
252 | *.sln.iml
253 |
--------------------------------------------------------------------------------
/Example1/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | username
15 |
16 |
17 | password
18 |
19 |
20 | applicationKey
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/Example1/Example1.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {9CD0258C-FC2D-493A-8D27-F6BD06C6776D}
8 | Exe
9 | Properties
10 | Example1
11 | Example1
12 | v4.6
13 | 512
14 | true
15 |
16 |
17 | AnyCPU
18 | true
19 | full
20 | false
21 | bin\Debug\
22 | DEBUG;TRACE
23 | prompt
24 | 4
25 |
26 |
27 | AnyCPU
28 | pdbonly
29 | true
30 | bin\Release\
31 | TRACE
32 | prompt
33 | 4
34 |
35 |
36 |
37 | ..\packages\Gedcomx.Model.1.0.6144.20322\lib\net45\Gedcomx.Model.dll
38 | True
39 |
40 |
41 | ..\packages\Gedcomx.Model.Fs.1.0.6144.20322\lib\net45\Gedcomx.Model.Fs.dll
42 | True
43 |
44 |
45 | ..\packages\Gedcomx.Model.Rs.1.0.6144.20322\lib\net45\Gedcomx.Model.Rs.dll
46 | True
47 |
48 |
49 | ..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll
50 | True
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 | True
67 | True
68 | Settings.settings
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 | SettingsSingleFileGenerator
77 | Settings.Designer.cs
78 |
79 |
80 |
81 |
82 | {dc9c289b-4ecc-41c5-8845-d29bedacd45e}
83 | Gedcomx.Api.Lite
84 |
85 |
86 |
87 |
94 |
--------------------------------------------------------------------------------
/Example1/Program.cs:
--------------------------------------------------------------------------------
1 | using Example1.Properties;
2 | using Gedcomx.Api.Lite;
3 | using Gx.Common;
4 | using Gx.Fs.Tree;
5 | using Newtonsoft.Json;
6 | using System;
7 | using System.Collections.Generic;
8 | using System.Linq;
9 | using System.Threading.Tasks;
10 |
11 | namespace Example1
12 | {
13 | class Program
14 | {
15 | public static JsonSerializerSettings jsettings = new JsonSerializerSettings
16 | {
17 | NullValueHandling = NullValueHandling.Ignore // Trims the extra content not needed in this case making things even faster with less content.
18 | };
19 |
20 | static void Main(string[] args)
21 | {
22 | var ft = new FamilySearchSDK(Settings.Default.UserName, Settings.Default.Password, Settings.Default.ApplicationKey, "Example1", "1.0.0", Gedcomx.Api.Lite.Environment.Integration);
23 |
24 | // Create a Person
25 | var gedcomx = new Gx.Gedcomx();
26 | gedcomx.AddPerson(TestBacking.GetCreateMalePerson());
27 |
28 | // Now post two of them to family search asynchronously
29 | var postTask = ft.Post("/platform/tree/persons", JsonConvert.SerializeObject(gedcomx), MediaType.X_GEDCOMX_v1_JSON);
30 | var postTask2 = ft.Post("/platform/tree/persons", JsonConvert.SerializeObject(gedcomx), MediaType.X_GEDCOMX_v1_JSON);
31 | Task.WaitAll(postTask, postTask2);
32 | var postResultSon = postTask.Result;
33 | var postResultFather = postTask2.Result;
34 |
35 | // Or if only one and you want synchronous results
36 | var postResults3 = ft.Post("/platform/tree/persons", JsonConvert.SerializeObject(gedcomx), MediaType.X_GEDCOMX_v1_JSON).Result;
37 |
38 | // Now get the new person.
39 | string personId = ((string[])postResultSon.Headers.Location.ToString().Split('/')).Last();
40 | var response = ft.Get("/platform/tree/persons/" + personId).Result;
41 |
42 | // By presuming we have single element.
43 | Console.WriteLine(response.persons[0].id + " - " + response.persons[0].display.name);
44 |
45 | // Get a person's portrait
46 | var portraitResponse = ft.Get($"/platform/tree/persons/{personId}/portrait", MediaType.X_FS_v1_JSON);
47 | var portrait = portraitResponse.Result;
48 | //Console.WriteLine(response.persons[0].id + " - " + response.persons[0].display.name);
49 |
50 | // Set parentage
51 | List relationships = new List();
52 | relationships.Add(new ChildAndParentsRelationship()
53 | {
54 | Father = new ResourceReference(postResultFather.Headers.Location.ToString()),
55 | Child = new ResourceReference(postResultSon.Headers.Location.ToString())
56 | });
57 | // use an array wrapper as we have to name the array.
58 | var content = JsonConvert.SerializeObject(new { childAndParentsRelationships = relationships }, jsettings);
59 |
60 | var rel = ft.Post("/platform/tree/relationships", content, MediaType.X_FS_v1_JSON);
61 | var results = rel.Result;
62 |
63 | // Now read the relationship back. (the Son)
64 | var anc = ft.Get("/platform/tree/ancestry?person=" + personId).Result;
65 | Console.WriteLine($"For {personId} then have these ancestors");
66 | foreach (var a in anc.persons)
67 | {
68 | Console.WriteLine(a.id + " - " + a.display.name);
69 | }
70 |
71 |
72 | // Now search!
73 | //platform/tree/search?q=motherGivenName%3AClarissa~%20fatherSurname%3AHeaton~%20motherSurname%3AHoyt~%20surname%3AHeaton~%20givenName%3AIsrael~%20fatherGivenName%3AJonathan~
74 | var encoded = Uri.EscapeDataString("motherGivenName:Clarissa~ fatherSurname:Heaton~ motherSurname:Hoyt~ surname:Heaton~ givenName:Israel~ fatherGivenName:Jonathan~");
75 | var searchResult = ft.Get("/platform/tree/search?q=" + encoded, MediaType.X_GEDCOMX_ATOM_JSON).Result;
76 |
77 | Console.WriteLine($"Found close hits {searchResult.searchInfo[0].closeHits} with {searchResult.searchInfo[0].totalHits} total");
78 |
79 | var stopCount = 1000;
80 | var totalFetched = 0;
81 | while (searchResult != null &&
82 | (totalFetched <= Convert.ToInt32(searchResult.results) || totalFetched > stopCount))
83 | {
84 | totalFetched = (searchResult.index + searchResult.entries.Count);
85 | foreach (var e in searchResult.entries)
86 | {
87 | var p = e.content.gedcomx.persons[0];
88 | Console.WriteLine($"{p.id} - {p.display.name} birthDate {p.display.birthDate} birthPlace {p.display.birthPlace}");
89 | }
90 |
91 | // Advance & get the next search results if there.
92 | if (searchResult.results > (searchResult.index + searchResult.entries.Count))
93 | {
94 | Console.WriteLine($"fetching another. total={totalFetched}");
95 | searchResult = ft.Get(searchResult.links.next.href.Value, MediaType.X_GEDCOMX_ATOM_JSON).Result;
96 | }
97 | }
98 |
99 | Console.WriteLine("Press Enter to Exit");
100 | Console.ReadLine();
101 | }
102 | }
103 | }
104 |
--------------------------------------------------------------------------------
/Example1/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("Example1")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("Example1")]
13 | [assembly: AssemblyCopyright("Copyright © 2016")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("9cd0258c-fc2d-493a-8d27-f6bd06c6776d")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/Example1/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace Example1.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 |
26 | [global::System.Configuration.ApplicationScopedSettingAttribute()]
27 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
28 | [global::System.Configuration.DefaultSettingValueAttribute("username")]
29 | public string UserName {
30 | get {
31 | return ((string)(this["UserName"]));
32 | }
33 | }
34 |
35 | [global::System.Configuration.ApplicationScopedSettingAttribute()]
36 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
37 | [global::System.Configuration.DefaultSettingValueAttribute("password")]
38 | public string Password {
39 | get {
40 | return ((string)(this["Password"]));
41 | }
42 | }
43 |
44 | [global::System.Configuration.ApplicationScopedSettingAttribute()]
45 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
46 | [global::System.Configuration.DefaultSettingValueAttribute("applicationKey")]
47 | public string ApplicationKey {
48 | get {
49 | return ((string)(this["ApplicationKey"]));
50 | }
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/Example1/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | username
7 |
8 |
9 | password
10 |
11 |
12 | applicationKey
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Example1/TestBacking.cs:
--------------------------------------------------------------------------------
1 | using Gx.Common;
2 | using Gx.Conclusion;
3 | using Gx.Source;
4 | using Gx.Types;
5 | using System;
6 | using System.Collections.Generic;
7 | using System.Linq;
8 |
9 | namespace Example1
10 | {
11 | public static class TestBacking
12 | {
13 | public static Person GetPersonForDeepCompare()
14 | {
15 | return new Person()
16 | {
17 | Living = false,
18 | Gender = new Gender()
19 | {
20 | KnownType = Gx.Types.GenderType.Male,
21 | Fields = new List(),
22 | Sources = new List(),
23 | Notes = new List(),
24 | Links = new List(),
25 | ExtensionElementsXml = new List