Skip to content

Add GetMappedCPL method to root moviebuff package#16

Merged
sasipriyags merged 4 commits intomasterfrom
copilot/implement-getmappedcpl-moviebuff
Dec 9, 2025
Merged

Add GetMappedCPL method to root moviebuff package#16
sasipriyags merged 4 commits intomasterfrom
copilot/implement-getmappedcpl-moviebuff

Conversation

Copy link
Contributor

Copilot AI commented Dec 9, 2025

Implements GetMappedCPL in the root moviebuff package to match the v2 package implementation from PR #15. The root package acts as a simplified wrapper that removes context parameters.

Changes

  • mapped_cpl.go: Type aliases exposing v2 structs (MappedCPL, MappedCPLMovie, MappedCPLPart)
  • moviebuff.go: Interface method and implementation delegating to v2.GetMappedCPL(context.Background(), cplID)
  • go.mod: Updated to use v2 dependency with commit 377fbb6

Usage

mb := moviebuff.New(moviebuff.Config{
    HostURL:     "https://api.moviebuff.com",
    StaticToken: "your-token",
})

cpl, err := mb.GetMappedCPL("ab9754d6-b1cf-4185-8554-4fc505670d7f")
if err != nil {
    // Handle error
}
fmt.Printf("Movie: %s, Part: %s\n", cpl.Movie.Name, cpl.Movie.Part.Name)

Follows the established pattern where root package methods wrap v2 methods with context.Background() for backward compatibility. No additional unit tests are included as the wrapper relies on existing v2 package test coverage.

Original prompt

A PR exists - @RealImage/moviebuff-sdk-go/pull/15 that implements the GetMappedCPL method and MappedCPL type in the v2 package. I want you to implement the same thing for the moviebuff package, but this will internally use the v2 type and method itself. Refer the other files in moviebuff package.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits December 9, 2025 10:24
Co-authored-by: navratan3 <109721452+navratan3@users.noreply.github.com>
Co-authored-by: navratan3 <109721452+navratan3@users.noreply.github.com>
Copilot AI changed the title [WIP] Add GetMappedCPL method and MappedCPL type to moviebuff package Add GetMappedCPL method to root moviebuff package Dec 9, 2025
Copilot AI requested a review from navratan3 December 9, 2025 10:31
go.mod Outdated
github.com/stretchr/testify v1.4.0
)

replace github.com/RealImage/moviebuff-sdk-go/v2 => ./v2
Copy link
Contributor

Choose a reason for hiding this comment

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

@copilot Please use the commit id 377fbb6 for moviebuff-sdk-go/v2 dependency instead of replace directive

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated to use v2 dependency with commit 377fbb6 and removed the replace directive. Changes in commit 354e13e.


}

func TestMoviebuff_GetMappedCPL(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

The unit test here seems redundant as we already have one for v2. Since this method is just a wrapper around v2 we don't need a unit test

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed the redundant unit tests since this is just a wrapper around v2. Changes in commit 354e13e.

Co-authored-by: navratan3 <109721452+navratan3@users.noreply.github.com>
Copilot AI requested a review from navratan3 December 9, 2025 10:43
@navratan3 navratan3 marked this pull request as ready for review December 9, 2025 10:46
@navratan3 navratan3 requested a review from sasipriyags December 9, 2025 10:47
@sasipriyags sasipriyags merged commit e881307 into master Dec 9, 2025
2 checks passed
@navratan3 navratan3 deleted the copilot/implement-getmappedcpl-moviebuff branch December 9, 2025 10:55
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.

3 participants