Skip to content

Update Serving API - from backend PR #5610 - #337

Closed
clllaur wants to merge 1 commit into
main-convertfrom
api-serving-update-5610
Closed

Update Serving API - from backend PR #5610#337
clllaur wants to merge 1 commit into
main-convertfrom
api-serving-update-5610

Conversation

@clllaur

@clllaur clllaur commented Oct 18, 2025

Copy link
Copy Markdown
Contributor

Updating TS Serving API after the latest changes from backend repo,
PR #5610

@clllaur
clllaur requested a review from a team October 18, 2025 20:05
@gemini-code-assist

Copy link
Copy Markdown

Summary of Changes

Hello @clllaur, 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 synchronizes the TypeScript Serving API definitions with recent changes from the backend, specifically PR #5610. The updates primarily focus on expanding visitor data capabilities, introducing new rule types for audience targeting, and refining the overall structure of configuration types to support these new features. This ensures the frontend API accurately reflects the backend's data models and available functionalities.

Highlights

  • Visitor Data API Endpoints: New API endpoints have been introduced for retrieving visitor data, accessible via both account/project IDs and SDK keys. This includes new request and response types for these operations.
  • Enhanced Audience Rule Types: The type definitions for audience rules have been updated. A new RuleObjectAudience type is now used for ConfigAudience rules, incorporating a new RuleElementAudience which includes a VisitorDataExistsMatchRule.
  • New Rule Types: The TextMatchRulesTypes now includes 'visitor_id', allowing for rules based on visitor IDs. Additionally, a new VisitorDataExistsMatchRulesTypes has been added to support checking for the existence of visitor data.
  • Project Configuration Update: The ConfigProject type now includes an optional placeholders array, which will list active placeholders used in experiences for a project.
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.

@sonarqubecloud

Copy link
Copy Markdown

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

Copy link
Copy Markdown

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 updates the TypeScript Serving API types to align with recent backend changes. The updates include adding new rule types like visitor_id and visitor_data_exists, defining new data structures for visitor data responses, and adding new API endpoints to fetch this data. The changes are well-structured and consistent. I've provided a couple of suggestions to reduce type duplication, which will improve code maintainability.


export type RuleElement = GenericTextMatchRule | GenericNumericMatchRule | GenericBoolMatchRule | GenericTextKeyValueMatchRule | GenericNumericKeyValueMatchRule | GenericBoolKeyValueMatchRule | CookieMatchRule | CountryMatchRule | LanguageMatchRule | GoalTriggeredMatchRule | SegmentBucketedMatchRule | DayOfWeekMatchRule | HourOfDayMatchRule | MinuteOfHourMatchRule | BrowserNameMatchRule | OsMatchRule | WeatherConditionMatchRule | VisitorTypeMatchRule | JsConditionMatchRule;

export type RuleElementAudience = GenericTextMatchRule | GenericNumericMatchRule | GenericBoolMatchRule | GenericTextKeyValueMatchRule | GenericNumericKeyValueMatchRule | GenericBoolKeyValueMatchRule | CookieMatchRule | CountryMatchRule | LanguageMatchRule | GoalTriggeredMatchRule | SegmentBucketedMatchRule | DayOfWeekMatchRule | HourOfDayMatchRule | MinuteOfHourMatchRule | BrowserNameMatchRule | OsMatchRule | WeatherConditionMatchRule | VisitorTypeMatchRule | JsConditionMatchRule | VisitorDataExistsMatchRule;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

To improve maintainability and reduce code duplication, you can define RuleElementAudience as an alias of RuleElementNoUrl since they are identical.

Suggested change
export type RuleElementAudience = GenericTextMatchRule | GenericNumericMatchRule | GenericBoolMatchRule | GenericTextKeyValueMatchRule | GenericNumericKeyValueMatchRule | GenericBoolKeyValueMatchRule | CookieMatchRule | CountryMatchRule | LanguageMatchRule | GoalTriggeredMatchRule | SegmentBucketedMatchRule | DayOfWeekMatchRule | HourOfDayMatchRule | MinuteOfHourMatchRule | BrowserNameMatchRule | OsMatchRule | WeatherConditionMatchRule | VisitorTypeMatchRule | JsConditionMatchRule | VisitorDataExistsMatchRule;
export type RuleElementAudience = RuleElementNoUrl;

Comment on lines +2831 to +2833
export type VisitorDataDefaultResponse = {
[key: string]: (string);
};

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The type VisitorDataDefaultResponse is identical to VisitorDataResponse. To avoid duplication and improve maintainability, you could define it as an alias.

export type VisitorDataDefaultResponse = VisitorDataResponse;

@abbaseya abbaseya closed this Nov 20, 2025
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