type Bitbucket = {
  username: string;
  password: string;
};
/**
 * Update a repository application property
 * Update an application property value stored against a repository.
 */
export async function main(
  auth: Bitbucket,
  workspace: string,
  repo_slug: string,
  app_key: string,
  property_name: string,
  body: { _attributes?: ("public" | "read_only")[]; [k: string]: unknown }
) {
  const url = new URL(
    `https://api.bitbucket.org/2.0/repositories/${workspace}/${repo_slug}/properties/${app_key}/${property_name}`
  );
  const response = await fetch(url, {
    method: "PUT",
    headers: {
      "Content-Type": "application/json",
      Authorization: "Basic " + btoa(`${auth.username}:${auth.password}`),
    },
    body: JSON.stringify(body),
  });
  if (!response.ok) {
    const text = await response.text();
    throw new Error(`${response.status} ${text}`);
  }
  return await response.text();
}
 Submitted by hugo697 180 days ago
type Bitbucket = {
  username: string;
  password: string;
};
/**
 * Update a repository application property
 * Update an application property value stored against a repository.
 */
export async function main(
  auth: Bitbucket,
  workspace: string,
  repo_slug: string,
  app_key: string,
  property_name: string,
  body: { _attributes?: ("public" | "read_only")[]; [k: string]: unknown }
) {
  const url = new URL(
    `https://api.bitbucket.org/2.0/repositories/${workspace}/${repo_slug}/properties/${app_key}/${property_name}`
  );
  const response = await fetch(url, {
    method: "PUT",
    headers: {
      "Content-Type": "application/json",
      Authorization: "Basic " + btoa(`${auth.username}:${auth.password}`),
    },
    body: JSON.stringify(body),
  });
  if (!response.ok) {
    const text = await response.text();
    throw new Error(`${response.status} ${text}`);
  }
  return await response.text();
}
 Submitted by hugo697 686 days ago
type Bitbucket = {
  username: string;
  password: string;
};
/**
 * Update a repository application property
 * Update an [application property](/cloud/bitbucket/application-properties/) value stored against a repository.
 */
export async function main(
  auth: Bitbucket,
  workspace: string,
  repo_slug: string,
  app_key: string,
  property_name: string,
  body: { _attributes?: ("public" | "read_only")[]; [k: string]: unknown }
) {
  const url = new URL(
    `https://api.bitbucket.org/2.0/repositories/${workspace}/${repo_slug}/properties/${app_key}/${property_name}`
  );
  const response = await fetch(url, {
    method: "PUT",
    headers: {
      "Content-Type": "application/json",
      Authorization: "Basic " + btoa(`${auth.username}:${auth.password}`),
    },
    body: JSON.stringify(body),
  });
  if (!response.ok) {
    const text = await response.text();
    throw new Error(`${response.status} ${text}`);
  }
  return await response.text();
}
 Submitted by hugo697 741 days ago