Skip to content

Commit

Permalink
Fix missing href key for live_site previews
Browse files Browse the repository at this point in the history
  • Loading branch information
baileyherbert committed Jul 21, 2022
1 parent e8d6ed0 commit d0abb0c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/endpoints/catalog.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Client } from '../clients/client';
import { ItemSearchOptions, CommentSearchOptions } from '../types/options';
import { MarketName, Collection, Item, ItemConversation, ItemShort, ItemMedium } from '../types/api';
import { MarketName, Collection, Item, ItemConversation, ItemShort, ItemMedium, SearchItem } from '../types/api';

import url from '../util/url';
import mutate from '../util/mutate';
Expand Down Expand Up @@ -168,7 +168,7 @@ export interface IItemVersionResponse {

export interface ISearchItemsResponse {
took: number;
matches: Item[];
matches: SearchItem[];
item: Item | null;
timed_out: boolean;
total_hits: number;
Expand Down
17 changes: 17 additions & 0 deletions src/types/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,13 @@ export interface Item {
type: string;
},
live_site ?: {
/**
* @deprecated The `url` field is not available except through search, but has been preserved for backwards
* compatibility. Please use the explicit `SearchItem` type if you need this field, as it will be removed
* in a future update.
*/
url: string;
href: string;
},
icon_preview ?: {
icon_url: string;
Expand All @@ -145,6 +151,17 @@ export interface Item {
}
};

/**
* Full details about a marketplace item found in search results.
*/
export type SearchItem = Omit<Item, 'previews'> & {
previews: Omit<Item['previews'], 'live_site'> & {
live_site ?: {
url: string;
}
}
};

/**
* An image resource used in items.
*/
Expand Down

0 comments on commit d0abb0c

Please sign in to comment.