Entry Objects and Masks

Because Entries have various pieces of metadata that you may wish to retrieve (but not always), there is a way to specify which data you want. When writing your application code, you need to be aware that depending on what data you ask for, the schema will slightly vary. To accomplish this we use a "GetMask". By default, when you retrieve an entry, it will simply be the entry itself, just the content. This example uses the get native function call.

var r = get(postHash)
// { content: "A great post", timestamp: 1230932182 }

If we also wish to see the EntryType, or its Sources though, we need to specify that, using a GetMask.

In this example we do a get with GetMask options, and it changes the schema of the result:

var r = get(postHash, { GetMask: HC.GetMask.All })
 "Entry": { content: "A great post", timestamp: 1230932182 },

In the documentation that follows, we reference either of the prior examples as objects of the type Entry-object.

Use one or more of the following modifiers.

  • HC.GetMask.Entry Include the entry object
  • HC.GetMask.EntryType Include the entry type as a string
  • HC.GetMask.Sources Include an array of hashes of the agents who committed this entry
  • HC.GetMask.All Include Entry, EntryType, and Sources

Use more than one by adding them (since they are integers). 

A valid options object can look like { GetMask: HC.GetMask.Entry + HC.GetMask.EntryType }

Go back to the API documentation.