postProjectsSites method

Future<ProjectsSiteDeploy?> postProjectsSites(
  1. ProjectsBuildSite projectsBuildSite
)

Generates a self-contained, mobile-responsive static site from a natural-language brief and deploys it live in one call.

Generates a self-contained, mobile-responsive static site from a natural-language brief and deploys it live in one call. One inference call turns brief (capped at 8 KiB) into a file manifest, which then runs through the SAME validation, guards and viewport guarantee as a hand-supplied manifest: index.html required at the root, absolute and traversal paths rejected, per-file and total size capped, and a mobile viewport meta tag injected into every HTML document that lacks one. The generated site is fully inline — no CDNs, no remote fonts or images — so it is CSP-safe. slug and name are optional: the model's own title is preferred, and a slug is derived or minted when none is given. It writes into the SAME org-scoped store as /v1/projects — it ensures a project (framework static) for the resolved slug and records a deployment — so this is a second entry point to one publish pipeline, not a second copy of project state. Ordering is the billing contract: the hosting gate runs BEFORE any inference or upload, so a denied gate generates and uploads NOTHING, and the debit lands once, only after the site is actually live. The tokens are billed to the same ledger the hosting fee was reserved against. Answers 503 when object storage or inference is unconfigured, and 400 when the model's manifest cannot be parsed or fails the guards. Scope: a validated principal is required (403 without one) and the site is published into THAT principal's org.

Parameters:

Implementation

Future<ProjectsSiteDeploy?> postProjectsSites(ProjectsBuildSite projectsBuildSite,) async {
  final response = await postProjectsSitesWithHttpInfo(projectsBuildSite,);
  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), 'ProjectsSiteDeploy',) as ProjectsSiteDeploy;

  }
  return null;
}