Skip to content

Add get custom work calendar API#374

Open
flc1125 wants to merge 3 commits intomasterfrom
feat-workspace-custom-work-calendar
Open

Add get custom work calendar API#374
flc1125 wants to merge 3 commits intomasterfrom
feat-workspace-custom-work-calendar

Conversation

@flc1125
Copy link
Member

@flc1125 flc1125 commented Jan 24, 2026

Summary by CodeRabbit

  • New Features

    • Added a custom work calendar API exposing weekdays, holidays, and workdays for a specific workspace and year.
  • Tests

    • Added comprehensive test coverage and sample response data for the new custom work calendar API.

✏️ Tip: You can customize this high-level summary in your review settings.

Copilot AI review requested due to automatic review settings January 24, 2026 15:41
@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Jan 24, 2026
@gemini-code-assist
Copy link

Summary of Changes

Hello @flc1125, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a new API endpoint and its corresponding Go client implementation to fetch custom work calendar information. It includes the necessary data structures for requests and responses, the service method implementation, and a dedicated unit test to ensure functionality and data integrity. This enhancement allows users to programmatically retrieve specific work calendar details, such as weekdays, holidays, and workdays for a given workspace and year.

Highlights

  • New API Endpoint: Introduced a new API endpoint /workspaces/get_custom_work_calendar to retrieve custom work calendar details.
  • Data Structures: Defined GetCustomWorkCalendarRequest and CustomWorkCalendar Go structs for handling request and response data respectively.
  • Service Implementation: Implemented the GetCustomWorkCalendar method within the WorkspaceService to handle the API call, including making an HTTP GET request to the new endpoint.
  • Unit Tests: Added a comprehensive unit test (TestWorkspaceService_GetCustomWorkCalendar) to verify the correct functioning of the new API method, including request parameter serialization and response deserialization.
  • Mock Data: Included a new JSON test data file (internal/testdata/api/workspace/get_custom_work_calendar.json) to provide mock responses for testing purposes.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@coderabbitai
Copy link

coderabbitai bot commented Jan 24, 2026

📝 Walkthrough

Walkthrough

Adds a new GetCustomWorkCalendar API to WorkspaceService with request/response types, an implementation performing GET to workspaces/get_custom_work_calendar, accompanying unit test, and test fixture JSON.

Changes

Cohort / File(s) Summary
Custom Work Calendar API Implementation
api_workspace.go
Adds GetCustomWorkCalendarRequest (workspace_id, year), CustomWorkCalendar (weekdays, holidays, workdays), extends WorkspaceService interface with GetCustomWorkCalendar, and implements the method to call workspaces/get_custom_work_calendar and return the parsed response
Tests and Test Data
api_workspace_test.go, internal/testdata/api/workspace/get_custom_work_calendar.json
Adds TestWorkspaceService_GetCustomWorkCalendar to verify query params and response parsing; adds JSON fixture with sample weekdays, holidays, and workdays

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant workspaceService as WorkspaceService
  participant API as "HTTP API (workspaces/get_custom_work_calendar)"
  Client->>workspaceService: GetCustomWorkCalendar(ctx, {workspace_id, year})
  workspaceService->>API: GET /workspaces/get_custom_work_calendar?workspace_id=...&year=...
  API-->>workspaceService: 200 OK + JSON {data: {weekdays, holidays, workdays}}
  workspaceService-->>Client: *CustomWorkCalendar, *Response, nil
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested labels

size:L

Poem

🐰 A little rabbit hops with glee,
A calendar for work and play to see,
Weekdays, holidays, and workdays align,
Fetching dates in a neat little line,
Happy hops for every team and tree!

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and accurately summarizes the main change: adding a new GetCustomWorkCalendar API endpoint with request/response types and implementation.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link

codecov bot commented Jan 24, 2026

Codecov Report

❌ Patch coverage is 55.55556% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
api_workspace.go 55.55% 2 Missing and 2 partials ⚠️
Files with missing lines Coverage Δ
api_workspace.go 52.27% <55.55%> (+0.84%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dosubot dosubot bot added the enhancement New feature or request label Jan 24, 2026
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request adds a new API endpoint for getting a custom work calendar, including the necessary request/response structs, service method, and tests. The implementation is straightforward. I have two suggestions to improve the code's robustness and clarity. One is regarding the use of pointers for required fields in the request struct, which can be fragile. The other is a minor style point about passing a pointer-to-a-pointer for JSON unmarshaling, where a simpler approach would be clearer.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds support for the "Get Custom Work Calendar" API endpoint, which allows retrieving custom work calendar details including weekdays, holidays, and workdays for a specified year.

Changes:

  • Added new API method GetCustomWorkCalendar to the WorkspaceService interface and implementation
  • Added request/response structures (GetCustomWorkCalendarRequest and CustomWorkCalendar)
  • Added comprehensive test coverage with mock data

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
internal/testdata/api/workspace/get_custom_work_calendar.json Test data for the get custom work calendar API response
api_workspace_test.go Unit test for the GetCustomWorkCalendar method
api_workspace.go API implementation including request/response structures and service method

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

flc1125 and others added 2 commits January 27, 2026 18:45
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants