postPlatformProjectsByProjectAppsByAppPreview method

Future<PreviewView?> postPlatformProjectsByProjectAppsByAppPreview(
  1. String project,
  2. String app,
  3. PreviewReq previewReq
)

Puts a branch on its own URL.

Puts a branch on its own URL. It deploys an already-built image to a per-branch preview and answers its URL, the branch, the preview's slug and the deployment. The preview is a FIRST-CLASS application named <app>-<branch> in the same project and tenant namespace, with its own default host — so it is completely isolated from production while reusing the same deploy mechanic. Re-previewing a branch converges that same target in place rather than stacking another one. It carries NO environment variables, deliberately: a preview never inherits production's secrets. It also does not build — image is required and must already exist, and branch defaults to the parent app's. A branch that does not resolve to a valid slug distinct from the parent's is 400. Requires a validated principal; 403 without one.

Parameters:

  • String project (required): Project is the project the parent application lives under, from the path.

  • String app (required): App is the parent application's slug, from the path.

  • PreviewReq previewReq (required):

Implementation

Future<PreviewView?> postPlatformProjectsByProjectAppsByAppPreview(String project, String app, PreviewReq previewReq,) async {
  final response = await postPlatformProjectsByProjectAppsByAppPreviewWithHttpInfo(project, app, previewReq,);
  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), 'PreviewView',) as PreviewView;

  }
  return null;
}