Skip to content

Comments

feat(gateway): implement Phase 1 connector API endpoints#32

Merged
TelivANT merged 3 commits intomainfrom
feat/wiki-connector-api-phase1
Feb 21, 2026
Merged

feat(gateway): implement Phase 1 connector API endpoints#32
TelivANT merged 3 commits intomainfrom
feat/wiki-connector-api-phase1

Conversation

@TelivANT
Copy link
Owner

πŸ“‘ Phase 1 Connector API Implementation

βœ… Implemented Endpoints

1. GET /v1/wiki/connectors

List all available connector types with metadata:

  • Connector type and name
  • Field definitions (name, type, required, options)
  • Sensitive field marking
  • Authentication requirements

Currently supports: Local, Git, S3 (more to be added)

2. POST /v1/wiki/connectors/test

Test connection with provided credentials:

  • Validates connector configuration
  • Returns connector ID (UUID v7)
  • Returns connection metadata
  • Error handling with error codes

Status: Basic structure (TODO: actual testing logic)

3. POST /v1/wiki/connectors/browse

Browse directory structure:

  • Lists files and directories
  • Returns file metadata (size, type, modified time)
  • Supports nested navigation

Status: Basic structure (TODO: actual browsing logic)

πŸ”§ Technical Details

UUID v7:

  • Time-sortable UUIDs for connector IDs
  • Better for database indexing
  • Maintains chronological order

Data Structures:

ConnectorMetadata {
    type, name, description,
    auth_required, fields[]
}

ConnectorField {
    name, type, required,
    default, options, sensitive,
    description
}

Field Types:

  • string, enum, boolean
  • Sensitive marking for credentials
  • Optional with defaults
  • Enum with predefined options

πŸ“Š Code Stats

  • wiki_connector.rs: 240 lines
  • 3 API endpoints
  • 8 data structures

🎯 Implementation Status

Phase 1 (This PR):

  • βœ… API structure defined
  • βœ… Routes integrated
  • βœ… Metadata endpoint complete
  • ⏳ Test/Browse endpoints (stubs)

Phase 2 (Next):

  • Connector instantiation
  • Actual connection testing
  • Directory browsing implementation
  • Session management

πŸ§ͺ Testing

Manual Test:

# List connectors
curl http://localhost:3000/v1/wiki/connectors

# Test connection
curl -X POST http://localhost:3000/v1/wiki/connectors/test \
  -H "Content-Type: application/json" \
  -d '{
    "type": "git",
    "config": {
      "url": "https://github.com/user/repo.git",
      "auth_type": "token",
      "token": "ghp_xxx"
    }
  }'

πŸ“‹ Next Steps

  1. Implement connector instantiation from config
  2. Implement actual connection testing
  3. Implement directory browsing with storage connectors
  4. Add session management for browsing
  5. Add credential encryption

πŸ”— Related

Phase 1 API Implementation:
1. GET /v1/wiki/connectors - List available connector types
2. POST /v1/wiki/connectors/test - Test connection
3. POST /v1/wiki/connectors/browse - Browse directory

Features:
- Connector metadata with field definitions
- Support for Local, Git, S3 connectors (more to add)
- UUID v7 for connector IDs (time-sortable)
- Proper field validation metadata
- Sensitive field marking

API Structure:
- ConnectorMetadata - Type, name, description, fields
- ConnectorField - Name, type, required, options, sensitive
- TestConnectionRequest/Response - Connection validation
- BrowseDirectoryRequest/Response - Directory listing

Implementation Status:
- βœ… API structure defined
- βœ… Routes integrated into wiki routes
- βœ… Basic responses (TODO: actual implementation)
- ⏳ Connection test logic (Phase 2)
- ⏳ Directory browsing logic (Phase 2)

Next:
- Implement actual connector instantiation
- Implement connection testing
- Implement directory browsing
- Add session management

Code: ~240 lines
Implementation Guide:
- Helper function for connector creation
- Test connection actual logic
- Browse directory options (stateless vs session)
- Add more connector metadata

Challenges:
- StorageConnector requires &mut self for connect()
- Need session management for browse
- Ownership handling (Box vs Arc)

Recommended Approach:
1. Implement test_connection (30 min)
2. Keep browse as stub
3. Merge PR #32
4. Session management in Phase 2

Estimated: 30-60 minutes for basic functionality
Changes:
- Add LocalConnector and GitConnector imports
- Implement actual connection testing for local and git
- Handle missing config fields with clear errors
- Return proper error codes on failure
- Keep UUID v7 for connector IDs

Supported:
- Local filesystem connector
- Git connector with optional token auth

Error Handling:
- Missing config fields -> INVALID_CONFIG
- Connection failures -> CONNECTION_FAILED

Next: Session management for browse_directory (Phase 2)
@TelivANT TelivANT merged commit 3dc1099 into main Feb 21, 2026
3 checks passed
@TelivANT TelivANT deleted the feat/wiki-connector-api-phase1 branch February 21, 2026 03:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant