Edits history of script submission #2177 for ' Delete a release reaction (github)'

  • nativets
    One script reply has been approved by the moderators
    Ap­pro­ved
    type Github = {
      token: string;
    };
    /**
     * Delete a release reaction
     * **Note:** You can also specify a repository by `repository_id` using the route `DELETE delete /repositories/:repository_id/releases/:release_id/reactions/:reaction_id`.
    
    Delete a reaction to a [release](https://docs.github.com/rest/reference/repos#releases).
     */
    export async function main(
      auth: Github,
      owner: string,
      repo: string,
      release_id: string,
      reaction_id: string
    ) {
      const url = new URL(
        `https://api.github.com/repos/${owner}/${repo}/releases/${release_id}/reactions/${reaction_id}`
      );
    
      const response = await fetch(url, {
        method: "DELETE",
        headers: {
          Authorization: "Bearer " + auth.token,
        },
        body: undefined,
      });
      if (!response.ok) {
        const text = await response.text();
        throw new Error(`${response.status} ${text}`);
      }
      return await response.text();
    }
    

    Submitted by hugo697 367 days ago

  • nativets
    type Github = {
      token: string;
    };
    /**
     * Delete a release reaction
     * **Note:** You can also specify a repository by `repository_id` using the route `DELETE delete /repositories/:repository_id/releases/:release_id/reactions/:reaction_id`.
    
    Delete a reaction to a [release](https://docs.github.com/rest/reference/repos#releases).
     */
    export async function main(
      auth: Github,
      owner: string,
      repo: string,
      release_id: string,
      reaction_id: string
    ) {
      const url = new URL(
        `https://api.github.com/repos/${owner}/${repo}/releases/${release_id}/reactions/${reaction_id}`
      );
    
      const response = await fetch(url, {
        method: "DELETE",
        headers: {
          Authorization: "Bearer " + auth.token,
        },
        body: undefined,
      });
      if (!response.ok) {
        const text = await response.text();
        throw new Error(`${response.status} ${text}`);
      }
      return await response.text();
    }
    

    Submitted by hugo697 927 days ago