Skip to content

Commit

Permalink
feat: add types for related prompts
Browse files Browse the repository at this point in the history
  • Loading branch information
victorcg88 committed Oct 21, 2024
1 parent 1aadc42 commit 233602f
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/x-types/src/query-signals/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export * from './next-queries.model';
export * from './next-query.model';
export * from './related-prompt.model';
export * from './related-tag.model';
export * from './semantic-query.model';
14 changes: 14 additions & 0 deletions packages/x-types/src/query-signals/related-prompt.model.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { NamedModel } from '../named-model.model';
import { Previewable } from '../previewable.model';

/**
* Represents a related prompt.
*/
export interface RelatedPrompt extends NamedModel<'RelatedPrompt'>, Required<Previewable> {
/** The next queries related to the prompt. */
nextQueries: Array<string>;
/** The prompt. */
suggestionText: string;
/** The type of the prompt. */
type: string;
}
1 change: 1 addition & 0 deletions packages/x-types/src/request/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export * from './next-queries-request.model';
export * from './popular-searches-request.model';
export * from './query-suggestions-request.model';
export * from './recommendations-request.model';
export * from './related-prompts-request.model';
export * from './related-tags-request.model';
export * from './request.model';
export * from './search-request.model';
Expand Down
6 changes: 6 additions & 0 deletions packages/x-types/src/request/related-prompts-request.model.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { QueryableRequest } from './request.model';

/**
* Request for Related Prompts endpoint.
*/
export interface RelatedPromptsRequest extends QueryableRequest {}
1 change: 1 addition & 0 deletions packages/x-types/src/response/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export * from './next-queries-response.model';
export * from './popular-searches-response.model';
export * from './query-suggestions-response.model';
export * from './recommendations-response.model';
export * from './related-prompts-response.model';
export * from './related-tags-response.model';
export * from './response.model';
export * from './search-response.model';
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { RelatedPrompt } from '../query-signals/related-prompt.model';

/**
* Response for the related prompts endpoint.
*/
export interface RelatedPromptsResponse {
relatedPromptsProducts: RelatedPrompt[];
}
5 changes: 4 additions & 1 deletion packages/x-types/src/x-components-adapter.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
PopularSearchesRequest,
QuerySuggestionsRequest,
RecommendationsRequest,
RelatedPromptsRequest,
RelatedTagsRequest,
SearchRequest,
SemanticQueriesRequest,
Expand All @@ -20,7 +21,8 @@ import {
RelatedTagsResponse,
SearchResponse,
SemanticQueriesResponse,
ExperienceControlsResponse
ExperienceControlsResponse,
RelatedPromptsResponse
} from './response';

export interface XComponentsAdapter {
Expand All @@ -29,6 +31,7 @@ export interface XComponentsAdapter {
nextQueries: EndpointAdapter<NextQueriesRequest, NextQueriesResponse>;
recommendations: EndpointAdapter<RecommendationsRequest, RecommendationsResponse>;
querySuggestions: EndpointAdapter<QuerySuggestionsRequest, QuerySuggestionsResponse>;
relatedPrompts: EndpointAdapter<RelatedPromptsRequest, RelatedPromptsResponse>;
relatedTags: EndpointAdapter<RelatedTagsRequest, RelatedTagsResponse>;
identifierResults: EndpointAdapter<IdentifierResultsRequest, IdentifierResultsResponse>;
tagging: EndpointAdapter<TaggingRequest, void>;
Expand Down

0 comments on commit 233602f

Please sign in to comment.