preview method

ACTION: preview

This action is used to get a reduced resolution (preview) version of the attachment. It is accessed by POSTing to .../attachments/1/preview

This will generate the URL and return it in the attachment_url attribute of the AttachmentActivity.

The has_preview attribute of an Attachment indicates if a preview is available. When a preview is not available this action will return a Not Found error with a status code of 404. using a path like this: https://api.planningcenteronline.com/services/v2/attachments/1/preview

data can be a JSON String, or JSON serializable Object that follows the JSON:API specifications. The PlanningCenterApiData helper class has been provided for just such a purpose.

Details: PlanningCenter API docs do not have a description for this action.

Implementation

Future<PlanningCenterApiResponse> preview(Object data) async {
  if (id == null) {
    return PlanningCenterApiError.messageOnly(
      'Actions must be called on items that already exist on the remote server',
    );
  }
  var url = '$apiEndpoint/preview';
  return api.call(url, verb: 'post', data: data, apiVersion: apiVersion);
}