Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Désinscrire les personnes des notifications auto par mail #201

Open
DavidBruant opened this issue Jun 16, 2024 · 0 comments
Open

Désinscrire les personnes des notifications auto par mail #201

DavidBruant opened this issue Jun 16, 2024 · 0 comments
Projects

Comments

@DavidBruant
Copy link
Contributor

des ptits morceaux de code

const unsubscribeQuery = `
  mutation ($input: UpdateSubscriptionInput!) {
    updateSubscription(input: $input) {
      subscribable {
        id
        viewerSubscription
      }
    }
  }
`;
const response = await fetch('https://api.github.com/graphql', {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${token}`,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      query: unsubscribeQuery,
      variables: {
        input: {
          subscribableId: `REPO_ID`,
          state: 'UNSUBSCRIBED'
        }
      }
    })
  });
async function getRepoId() {
  const repoIdQuery = `
    query {
      repository(owner: "${owner}", name: "${repo}") {
        id
      }
    }
  `;

  const response = await fetch('https://api.github.com/graphql', {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${token}`,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({ query: repoIdQuery })
  });

  const result = await response.json();
  return result.data.repository.id;
}
@DavidBruant DavidBruant created this issue from a note in Grainerie (Grainerie 🌱) Jun 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Grainerie
Grainerie 🌱
Development

No branches or pull requests

1 participant