slides

package
v0.3.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 17, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultSlidesHandlerDeps = common.NewDefaultHandlerDeps(NewSlidesService)

DefaultSlidesHandlerDeps holds the default dependencies for production use.

Functions

func InitDefaultSlidesHandlerDeps added in v0.1.7

func InitDefaultSlidesHandlerDeps(appDeps *common.Deps)

InitDefaultSlidesHandlerDeps initializes the default Slides handler deps with explicit deps.

func RegisterTools

func RegisterTools(s *server.MCPServer)

RegisterTools registers all Slides tools with the MCP server.

func TestableSlidesBatchUpdate

func TestableSlidesBatchUpdate(ctx context.Context, request mcp.CallToolRequest, deps *SlidesHandlerDeps) (*mcp.CallToolResult, error)

TestableSlidesBatchUpdate performs a batch update on a presentation.

func TestableSlidesCreate

func TestableSlidesCreate(ctx context.Context, request mcp.CallToolRequest, deps *SlidesHandlerDeps) (*mcp.CallToolResult, error)

TestableSlidesCreate creates a new presentation.

func TestableSlidesGetPage

func TestableSlidesGetPage(ctx context.Context, request mcp.CallToolRequest, deps *SlidesHandlerDeps) (*mcp.CallToolResult, error)

TestableSlidesGetPage retrieves a single page/slide with full element details.

func TestableSlidesGetPresentation

func TestableSlidesGetPresentation(ctx context.Context, request mcp.CallToolRequest, deps *SlidesHandlerDeps) (*mcp.CallToolResult, error)

TestableSlidesGetPresentation retrieves a presentation's metadata, slides, and structure.

func TestableSlidesGetThumbnail

func TestableSlidesGetThumbnail(ctx context.Context, request mcp.CallToolRequest, deps *SlidesHandlerDeps) (*mcp.CallToolResult, error)

TestableSlidesGetThumbnail retrieves a thumbnail image URL for a slide.

Types

type MockSlidesService

type MockSlidesService struct {
	// Presentations stores mock presentation data keyed by ID.
	Presentations map[string]*slides.Presentation

	// Errors allows tests to configure specific errors for methods.
	Errors struct {
		GetPresentation  error
		GetPage          error
		GetPageThumbnail error
		Create           error
		BatchUpdate      error
	}

	// Calls tracks method invocations for verification.
	Calls struct {
		GetPresentation  []string
		GetPage          []struct{ PresentationID, PageID string }
		GetPageThumbnail []struct{ PresentationID, PageID string }
		Create           []string
		BatchUpdate      []struct {
			PresentationID string
			Requests       []*slides.Request
		}
	}
}

MockSlidesService implements SlidesService for testing.

func NewMockSlidesService

func NewMockSlidesService() *MockSlidesService

NewMockSlidesService creates a new mock Slides service with default test data.

func (*MockSlidesService) BatchUpdate

func (m *MockSlidesService) BatchUpdate(ctx context.Context, presentationID string, requests []*slides.Request) (*slides.BatchUpdatePresentationResponse, error)

BatchUpdate performs a mock batch update.

func (*MockSlidesService) CreatePresentation

func (m *MockSlidesService) CreatePresentation(ctx context.Context, title string) (*slides.Presentation, error)

CreatePresentation creates a mock presentation.

func (*MockSlidesService) GetPage

func (m *MockSlidesService) GetPage(ctx context.Context, presentationID string, pageID string) (*slides.Page, error)

GetPage retrieves a mock page by ID.

func (*MockSlidesService) GetPageThumbnail

func (m *MockSlidesService) GetPageThumbnail(ctx context.Context, presentationID string, pageID string) (*slides.Thumbnail, error)

GetPageThumbnail retrieves a mock thumbnail for a page.

func (*MockSlidesService) GetPresentation

func (m *MockSlidesService) GetPresentation(ctx context.Context, presentationID string) (*slides.Presentation, error)

GetPresentation retrieves a mock presentation by ID.

type RealSlidesService

type RealSlidesService struct {
	// contains filtered or unexported fields
}

RealSlidesService wraps the Slides API client and implements SlidesService.

func NewRealSlidesService

func NewRealSlidesService(service *slides.Service) *RealSlidesService

NewRealSlidesService creates a new RealSlidesService wrapping the given API service.

func (*RealSlidesService) BatchUpdate

func (s *RealSlidesService) BatchUpdate(ctx context.Context, presentationID string, requests []*slides.Request) (*slides.BatchUpdatePresentationResponse, error)

BatchUpdate performs a batch update on a presentation.

func (*RealSlidesService) CreatePresentation

func (s *RealSlidesService) CreatePresentation(ctx context.Context, title string) (*slides.Presentation, error)

CreatePresentation creates a new presentation.

func (*RealSlidesService) GetPage

func (s *RealSlidesService) GetPage(ctx context.Context, presentationID string, pageID string) (*slides.Page, error)

GetPage retrieves a single page by ID.

func (*RealSlidesService) GetPageThumbnail

func (s *RealSlidesService) GetPageThumbnail(ctx context.Context, presentationID string, pageID string) (*slides.Thumbnail, error)

GetPageThumbnail retrieves a thumbnail URL for a page.

func (*RealSlidesService) GetPresentation

func (s *RealSlidesService) GetPresentation(ctx context.Context, presentationID string) (*slides.Presentation, error)

GetPresentation retrieves a presentation by ID.

type SlidesHandlerDeps

type SlidesHandlerDeps = common.HandlerDeps[SlidesService]

Type alias using generic types from common package.

type SlidesService

type SlidesService interface {
	// GetPresentation retrieves a presentation by ID.
	GetPresentation(ctx context.Context, presentationID string) (*slides.Presentation, error)

	// GetPage retrieves a single page (slide) by ID.
	GetPage(ctx context.Context, presentationID string, pageID string) (*slides.Page, error)

	// GetPageThumbnail retrieves a thumbnail image URL for a page.
	GetPageThumbnail(ctx context.Context, presentationID string, pageID string) (*slides.Thumbnail, error)

	// CreatePresentation creates a new presentation with the given title.
	CreatePresentation(ctx context.Context, title string) (*slides.Presentation, error)

	// BatchUpdate performs a batch update on a presentation.
	BatchUpdate(ctx context.Context, presentationID string, requests []*slides.Request) (*slides.BatchUpdatePresentationResponse, error)
}

SlidesService defines the interface for Google Slides API operations. This interface enables dependency injection and testing with mocks.

func NewSlidesService

func NewSlidesService(ctx context.Context, client *http.Client) (SlidesService, error)

NewSlidesService creates a SlidesService from an authenticated HTTP client.

func ResolveSlidesServiceOrError

func ResolveSlidesServiceOrError(ctx context.Context, request mcp.CallToolRequest, deps *SlidesHandlerDeps) (SlidesService, *mcp.CallToolResult, bool)

ResolveSlidesServiceOrError resolves a Slides service, returning an MCP error result on failure.

type SlidesTestFixtures

type SlidesTestFixtures struct {
	DefaultEmail string
	MockService  *MockSlidesService
	Deps         *SlidesHandlerDeps
}

SlidesTestFixtures contains test fixtures for Slides tool testing.

func NewSlidesTestFixtures

func NewSlidesTestFixtures() *SlidesTestFixtures

NewSlidesTestFixtures creates a new set of test fixtures.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL