Skip to content

feat(drive): add Drive client foundation and parent command #61

@rianjs

Description

@rianjs

Summary

Add the foundational infrastructure for Google Drive support, including the OAuth scope, API client package, and parent command registration.

Scope

This issue establishes the patterns that all subsequent Drive commands will follow.

Tasks

1. Add OAuth Scope

  • Add drive.DriveReadonlyScope to AllScopes in internal/auth/auth.go
  • Import google.golang.org/api/drive/v3

2. Create Drive API Client Package (internal/drive/)

  • interfaces.go - Define DriveClientInterface
  • client.go - Drive service wrapper with NewClient(ctx) factory
  • files.go - File data types and parsing helpers

3. Create Command Package (internal/cmd/drive/)

  • drive.go - Parent command with files alias
  • output.go - Shared output helpers (printJSON, ClientFactory)

4. Register Command

  • Add import and AddCommand() in internal/cmd/root/root.go

Data Types

type File struct {
    ID           string    `json:"id"`
    Name         string    `json:"name"`
    MimeType     string    `json:"mimeType"`
    Size         int64     `json:"size,omitempty"`
    CreatedTime  time.Time `json:"createdTime,omitempty"`
    ModifiedTime time.Time `json:"modifiedTime,omitempty"`
    Parents      []string  `json:"parents,omitempty"`
    Owners       []string  `json:"owners,omitempty"`
    WebViewLink  string    `json:"webViewLink,omitempty"`
    Shared       bool      `json:"shared"`
}

Interface

type DriveClientInterface interface {
    ListFiles(query string, pageSize int64) ([]*File, error)
    GetFile(fileID string) (*File, error)
    DownloadFile(fileID string, mimeType string) ([]byte, error)
    ExportFile(fileID string, exportMimeType string) ([]byte, error)
}

Acceptance Criteria

  • gro drive shows help with available subcommands
  • gro files works as alias
  • make verify passes
  • Client can be instantiated with valid OAuth token

Blocked By

None - this is the foundation issue

Blocks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions