Edits history of script submission #1910 for ' Delete an issue reaction (github)'

  • nativets
    One script reply has been approved by the moderators
    Ap­pro­ved
    type Github = {
      token: string;
    };
    /**
     * Delete an issue reaction
     * **Note:** You can also specify a repository by `repository_id` using the route `DELETE /repositories/:repository_id/issues/:issue_number/reactions/:reaction_id`.
    
    Delete a reaction to an [issue](https://docs.github.com/rest/reference/issues/).
     */
    export async function main(
      auth: Github,
      owner: string,
      repo: string,
      issue_number: string,
      reaction_id: string
    ) {
      const url = new URL(
        `https://api.github.com/repos/${owner}/${repo}/issues/${issue_number}/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 an issue reaction
     * **Note:** You can also specify a repository by `repository_id` using the route `DELETE /repositories/:repository_id/issues/:issue_number/reactions/:reaction_id`.
    
    Delete a reaction to an [issue](https://docs.github.com/rest/reference/issues/).
     */
    export async function main(
      auth: Github,
      owner: string,
      repo: string,
      issue_number: string,
      reaction_id: string
    ) {
      const url = new URL(
        `https://api.github.com/repos/${owner}/${repo}/issues/${issue_number}/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