Skip to content

Conversation

@PatrickHeneise
Copy link
Member

Summary

Adds support for fetching organization-level statistics and metadata.

Closes #6

Changes

  • ✨ Add getOrganization() function to main API
  • πŸ“ Add GraphQL query for organization data
  • βœ… Add comprehensive test suite
  • πŸ“š Update README with API documentation

API Usage

import { getOrganization } from 'gitevents-fetch'

const org = await getOrganization('myorg')
console.log(org)
// {
//   name: 'My Organization',
//   login: 'myorg',
//   description: 'We build amazing things',
//   memberCount: 42,
//   publicRepoCount: 128,
//   ...
// }

Features

  • βœ… Organization metadata (name, description, website, location)
  • βœ… Member count and public repository statistics
  • βœ… Avatar URL and contact email
  • βœ… Created/updated timestamps as Date objects
  • βœ… Returns null if organization not found
  • βœ… Null-safe handling of all optional fields

Organization Object Structure

{
  name: string | null
  login: string | null
  description: string | null
  websiteUrl: string | null
  avatarUrl: string | null
  email: string | null
  location: string | null
  createdAt: Date | null
  updatedAt: Date | null
  memberCount: number
  publicRepoCount: number
}

Test Plan

  • Unit tests for parameter validation
  • Unit tests for successful data fetching
  • Unit tests for missing optional fields
  • Unit tests for organization not found
  • Unit tests for GraphQL errors
  • Integration test with real API
  • README documentation

πŸ€– Generated with Claude Code

Add functionality to fetch organization-level statistics and metadata.

## Changes

- Add `getOrganization()` function to fetch org metadata
- Add GraphQL query for organization data
- Add comprehensive test suite
- Update README with API documentation

## API

```javascript
import { getOrganization } from 'gitevents-fetch'

const org = await getOrganization('myorg')
// Returns: { name, login, description, memberCount, publicRepoCount, ... }
```

## Features

- Organization metadata (name, description, website, location)
- Member count and public repository count
- Avatar URL and contact email
- Created/updated timestamps
- Returns null if organization not found

πŸ€– Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings October 29, 2025 16:38
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds organization fetching functionality to the gitevents-fetch library, allowing users to retrieve GitHub organization statistics and metadata. The version has been bumped from 0.0.3-dev to 0.0.4 as a release version.

  • Added getOrganization() function to fetch organization data via GraphQL
  • Created comprehensive test coverage for the new functionality
  • Updated documentation with API usage examples

Reviewed Changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/organization.js Implements the core organization fetching logic with parameter validation and error handling
src/graphql/organization.gql Defines the GraphQL query for fetching organization data
src/lib/parseGql.js Registers the new organization query
src/index.js Exports the public API for getOrganization
test/organization.test.js Provides comprehensive unit and integration tests
README.md Documents the new organization fetching feature
package.json, package-lock.json Version bump to 0.0.4

πŸ’‘ Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

try {
const query = await parseGql('organization')
const vars = {
organization: org
Copy link

Copilot AI Oct 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Variable 'org' is used before its declaration.

Copilot uses AI. Check for mistakes.
@PatrickHeneise PatrickHeneise changed the title feat: add organization statistics support (#6) feat: add organization statistics support Oct 29, 2025
- Fix variable shadowing issue in src/organization.js (renamed `org` to `orgData`)
- Update getOrganization to use getGraphqlClient() pattern for consistency
- Add parameter validation for getOrganization
- Merge main branch changes (locations, users, files features)
- Handle permission errors in organization test gracefully
- All tests passing (65/65)
- ESLint passing with no errors

Resolves code review comment from Copilot about variable shadowing.

πŸ€– Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@PatrickHeneise PatrickHeneise merged commit e7622ea into main Oct 29, 2025
6 checks passed
@PatrickHeneise PatrickHeneise deleted the feature/organization-stats-6 branch October 29, 2025 22:53
@github-actions
Copy link

πŸŽ‰ This PR is included in version 1.3.0 πŸŽ‰

The release is available on:

Your semantic-release bot πŸ“¦πŸš€

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for fetching organization statistics

2 participants