getProjectsBySlug method

Future<ProjectsProject?> getProjectsBySlug(
  1. String slug
)

Returns one project of yours by slug — its settings, its live URL and the deployment currently serving it.

Returns one project of yours by slug — its settings, its live URL and the deployment currently serving it. Scope: a validated principal is required (403 without one) and the lookup is keyed by (org, slug), so another tenant's slug is a 404 exactly like a nonexistent one.

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<ProjectsProject?> getProjectsBySlug(String slug,) async {
  final response = await getProjectsBySlugWithHttpInfo(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) {
    return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'ProjectsProject',) as ProjectsProject;

  }
  return null;
}