patchProjectsBySlug method

Future<ProjectsProject?> patchProjectsBySlug(
  1. String slug,
  2. ProjectsUpdate projectsUpdate
)

Changes a project's settings, and only the settings you send.

Changes a project's settings, and only the settings you send. Every field is optional and absent means "leave it": name may not be blanked, framework must stay a known build hint, and cacheControl is capped at 256 characters with no newlines (it becomes a response header). visibility flips public/private under the same rule as create — public is free, private needs a funded org. upstream and license are free-text credit for third-party work, and sending "" clears one. Changing anything reconciles the project's canonical git repo, so a visibility change reaches the source and not just the listing. hidden/hiddenReason are platform MODERATION and are ignored unless the caller is a platform admin; they remove a project from the public catalogue without touching the publisher's own visibility choice, so un-hiding restores exactly what they asked for. 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 update, from the path. The URL is the addressing authority — a slug in the body cannot move the write to another project.

  • ProjectsUpdate projectsUpdate (required):

Implementation

Future<ProjectsProject?> patchProjectsBySlug(String slug, ProjectsUpdate projectsUpdate,) async {
  final response = await patchProjectsBySlugWithHttpInfo(slug, projectsUpdate,);
  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;
}