Callbacks and errors

Most methods take success and error callbacks as their last two arguments; they do not return Promises. Supply {} when an options object is required but you are not accessing a shared link. Optional positional values still need a null or undefined placeholder when later arguments follow.

Validation can throw synchronously, while network and permission failures are usually delivered to the error callback. Handle both:

const onSuccess = response => console.log(response);
const onError = error => console.error(error);

try {
  sdk.getItem([123], {}, onSuccess, onError);
} catch (error) {
  onError(error);
}

Error values can be Error objects, strings, or API responses. For example, user_is_missing_required_permissions indicates a missing Geens permission. The API examples below reuse sdk, onSuccess, and onError from above. Sample item IDs must be replaced with IDs your session can access.