render method

ACTION: render

Render an email template and fill in the persons details using a path like this: https://api.planningcenteronline.com/services/v2/email_templates/1/render

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: Render the template with information from the person.

{
  "data": {
    "attributes": {
      "format": "html|text"
    },
    "relationships": {
      "person": {
        "data": {
          "type": "Person",
          "id": "1"
        }
      }
    }
  }
}

Implementation

Future<PlanningCenterApiResponse> render(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/render';
  return api.call(url, verb: 'post', data: data, apiVersion: apiVersion);
}