getProjectsBySlugDeployments method

Future<List<ProjectsDeployment>?> getProjectsBySlugDeployments(
  1. String slug
)

Returns a project's deploy history, newest version first.

Returns a project's deploy history, newest version first. Every deploy of the project is a row — uploads, generated sites, and git/CI builds alike — carrying its version, status, source, commit, live URL, file count and byte count. The short-lived upload grant a queued git deployment was handed is NOT replayed here: it exists only on the 202 that minted it, so a grant cannot outlive its build by being fetched again. Scope: a validated principal is required (403 without one) and the project is resolved within that principal's org, so another tenant's slug is a 404.

Parameters:

  • String slug (required): Slug is the project to act on, from the path. It is unique within the caller's org and nowhere else, so another tenant's slug is a 404.

Implementation

Future<List<ProjectsDeployment>?> getProjectsBySlugDeployments(String slug,) async {
  final response = await getProjectsBySlugDeploymentsWithHttpInfo(slug,);
  if (response.statusCode >= HttpStatus.badRequest) {
    throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  }
  // When a remote server returns no body with a status of 204, we shall not decode it.
  // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  // FormatException when trying to decode an empty string.
  if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
    final responseBody = await _decodeBodyBytes(response);
    return (await apiClient.deserializeAsync(responseBody, 'List<ProjectsDeployment>') as List)
      .cast<ProjectsDeployment>()
      .toList(growable: false);

  }
  return null;
}