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

[CON-1575] feat: Add ListMetadata Github Connector #1438

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions providers/github/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

# GitHub Connector

## Authentication Methods
GitHub provides multiple authentication methods:
- Personal Access Token (PAT)
- OAuth2 (used by this connector)
- GitHub App Authentication(JSON Web Tokens)
- Fine-grained Personal Access Token (Beta)


### Authentication Edge Cases
Some endpoints only support specific authentication methods. For example:
- Notification endpoints require Fine-grained access tokens.
- Some endpoints don't support OAuth authentication at all
- Enterprise-specific endpoints might require different authentication methods

### Since Parameter Variations
The `since` parameter behavior varies across endpoints:

1. Timestamp-based (most common):
- Format: ISO 8601 (`YYYY-MM-DDTHH:MM:SSZ`)
- Example: `?since=2024-03-15T14:30:45Z`

2. ID-based (numeric):
- Some endpoints use `since` as an ID filter instead of a timestamp
- Format: Integer
- Example: `?since=12345`
- Used in endpoints like:
- `/users` (filters by user ID)
37 changes: 37 additions & 0 deletions providers/github/connector.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package github

import (
_ "embed"

"github.com/amp-labs/connectors/common"
"github.com/amp-labs/connectors/internal/components"
"github.com/amp-labs/connectors/internal/components/schema"
"github.com/amp-labs/connectors/providers"
"github.com/amp-labs/connectors/providers/github/metadata"
)

type Connector struct {
// Basic connector
*components.Connector

// Require authenticated client
common.RequireAuthenticatedClient

// supported operations
components.SchemaProvider
}

func NewConnector(params common.Parameters) (*Connector, error) {
// Create base connector with provider info
return components.Initialize(providers.Github, params, constructor)
}

//nolint:funlen
func constructor(base *components.Connector) (*Connector, error) {
connector := &Connector{Connector: base}

// Set the metadata provider for the connector
connector.SchemaProvider = schema.NewOpenAPISchemaProvider(connector.ProviderContext.Module(), metadata.Schemas)

return connector, nil
}
Loading