-
Notifications
You must be signed in to change notification settings - Fork 25
Architecture
All classes extend BaseClass
which contains common functionality for managing IDs and links, maintaining pointers to the SDK instance that the object is associated with, and serialization. Each class is in its own file in the src/classes
directory.
All constructors have (client, data)
as their signature. client
is an SDK instance. Each object needs a reference to the SDK instance that created it, otherwise it won't be able to make any requests to the API for retrieving additional data or saving changes.
data
is an optional JSON object containing the data for the object. The structure of the JSON should match what is returned by the API.
Any object can be turned back into a JSON object by calling toJSON()
or serialized into a JSON string by calling toString()
.
Modules are groupings of common functionality. They determine the groupings contained in the SDK documentation and largely reflect the groupings contained in the API documentation.
Not all methods can be called directly due to Collections defining entry points into the API. For example, you can't request a person's change history without first requesting the person and then requesting their changes by calling getChanges()
on the person object. This means many methods only accept a full URL while only a few methods can also accept an ID.
-
FamilySearch.js
is the main file that contains the definition of the FamilySearch class, includes all other files it needs, and handles instantiation of SDK instances. -
globals.js
defines defaults for configuration options. -
helpers.js
andutils.js
contain utility methods. There was some attempt to distinguish the two files by having all methods which need access to an SDK instance inhelpers.js
and all static methods inutils.js
but the separation was never completed. -
overview.js
contains content for the home page of the documentation. -
plumbing.js
contains methods for issuing and managing HTTP requests. -
relationshipHelpers.js
is a group of methods shared by some modules to manage relationships.