postProjectsBySlugDomainsWithHttpInfo method

Future<Response> postProjectsBySlugDomainsWithHttpInfo(
  1. String slug,
  2. ProjectsDomainsBind projectsDomainsBind
)

Attaches one or more CUSTOM public hostnames to this org's site.

Attaches one or more CUSTOM public hostnames to this org's site. Binding a host you do not own would let you shadow it at the edge, so which outcome you get depends on whether ownership is already established: a SuperAdmin vouches (the operator manages the customer's DNS, so its bind IS the proof) and binds VERIFIED immediately; every other caller, INCLUDING an admin of the deployment's own brand org, has the host CLAIMED as pending and gets the DNS challenge back in bound[].records. A pending claim HOLDS the name so nobody else can take it, but it does not route until POST .../domains/{host}/verify proves control. A hostname we operate is refused to a non-vouched caller (those are assigned by the platform, never claimed), a host another site already holds is a 409, and a name the platform holds is a 400 for EVERY caller — a vouch skips the ownership proof, never the host table's own invariant. Claims and binds are idempotent for the same (org, slug), and re-claiming returns the SAME token rather than invalidating a record the customer has already published. The edge cache-tag is flushed afterwards so a newly-verified host serves the current build immediately. Scope: a validated principal is required (403 without one) and the site is resolved within that principal's org, so another tenant's slug is a 404.

Note: This method returns the HTTP Response.

Parameters:

  • String slug (required): Slug is the site the hosts attach to, from the path.

  • ProjectsDomainsBind projectsDomainsBind (required):

Implementation

Future<Response> postProjectsBySlugDomainsWithHttpInfo(String slug, ProjectsDomainsBind projectsDomainsBind,) async {
  // ignore: prefer_const_declarations
  final path = r'/v1/projects/{slug}/domains'
    .replaceAll('{slug}', slug);

  // ignore: prefer_final_locals
  Object? postBody = projectsDomainsBind;

  final queryParams = <QueryParam>[];
  final headerParams = <String, String>{};
  final formParams = <String, String>{};

  const contentTypes = <String>['application/json'];


  return apiClient.invokeAPI(
    path,
    'POST',
    queryParams,
    postBody,
    headerParams,
    formParams,
    contentTypes.isEmpty ? null : contentTypes.first,
  );
}