archive method

ACTION: archive

Archive a Media. using a path like this: https://api.planningcenteronline.com/services/v2/media/1/archive

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: Accepts an optional time attribute (ISO 8601) for scheduling archival for a future time.

{
  "data": {
    "type": "MediaArchive",
    "attributes": {
      "time": "2023-01-20T00:00:00Z"
    }
  }
}

Implementation

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