Home / Function/ fetchDiscussions() — supabase Function Reference

fetchDiscussions() — supabase Function Reference

Architecture documentation for the fetchDiscussions() function in github-discussion.ts from the supabase codebase.

Entity Profile

Dependency Diagram

graph TD
  7ee3b36e_0fc7_5210_d531_7855f0c5c417["fetchDiscussions()"]
  bb2c79de_bc44_4879_8e44_cbf11b580212["fetchAllSources()"]
  bb2c79de_bc44_4879_8e44_cbf11b580212 -->|calls| 7ee3b36e_0fc7_5210_d531_7855f0c5c417
  style 7ee3b36e_0fc7_5210_d531_7855f0c5c417 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/docs/scripts/search/sources/github-discussion.ts lines 35–79

export async function fetchDiscussions(owner: string, repo: string, categoryId: string) {
  const octokit = new ExtendedOctokit({
    authStrategy: createAppAuth,
    auth: {
      appId,
      installationId,
      privateKey: crypto.createPrivateKey(privateKey!).export({ type: 'pkcs8', format: 'pem' }),
    },
  })

  const {
    repository: {
      discussions: { nodes: discussions },
    },
  } = await octokit.graphql.paginate<DiscussionsResponse>(
    `
      query troubleshootDiscussions($cursor: String, $owner: String!, $repo: String!, $categoryId: ID!) {
        repository(owner: $owner, name: $repo) {
          discussions(first: 100, after: $cursor, categoryId: $categoryId) {
            totalCount
            nodes {
              id
              updatedAt
              url
              title
              body
              databaseId
            }
            pageInfo {
              hasNextPage
              endCursor
            }
          }
        }
      }
    `,
    {
      owner,
      repo,
      categoryId,
    }
  )

  return discussions
}

Subdomains

Called By

Frequently Asked Questions

What does fetchDiscussions() do?
fetchDiscussions() is a function in the supabase codebase.
What calls fetchDiscussions()?
fetchDiscussions() is called by 1 function(s): fetchAllSources.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free