Skip to content

Commit 856ccd9

Browse files
committed
chore: minor changes
1 parent 9ae32b4 commit 856ccd9

File tree

6 files changed

+67
-66
lines changed

6 files changed

+67
-66
lines changed

typings/index.d.ts

Lines changed: 13 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import {
1313
PvPTeamGetResult,
1414
PvPTeamSearchParams,
1515
PvPTeamSearchResult,
16+
SearchIndexResult,
17+
SearchIndexes,
1618
SearchResult,
1719
} from "./utils";
1820
export * from "./utils";
@@ -43,36 +45,7 @@ declare module "@xivapi/js" {
4345
/**
4446
* Search a specific series of indexes separated by commas.
4547
*/
46-
indexes: [
47-
| "Achievement"
48-
| "Title"
49-
| "Action"
50-
| "CraftAction"
51-
| "Trait"
52-
| "PvPAction"
53-
| "PvPTrait"
54-
| "Status"
55-
| "BNpcName"
56-
| "ENpcResident"
57-
| "Companion"
58-
| "Mount"
59-
| "Leve"
60-
| "Emote"
61-
| "InstanceContent"
62-
| "Item"
63-
| "Recipe"
64-
| "Fate"
65-
| "Quest"
66-
| "ContentFinderCondition"
67-
| "Balloon"
68-
| "BuddyEquip"
69-
| "Orchestrion"
70-
| "PlaceName"
71-
| "Weather"
72-
| "World"
73-
| "Map"
74-
| "lore_finder"
75-
];
48+
indexes: SearchIndexes[];
7649

7750
/**
7851
* Search for lore! This is a special built search endpoint which searches a string through various lore specific content.
@@ -105,9 +78,9 @@ declare module "@xivapi/js" {
10578
}
10679

10780
export default class XIVAPI {
108-
public readonly options: XIVAPIOptions;
109-
public readonly endpoint: string;
110-
public readonly globalParams: { [key: string]: string | number };
81+
private readonly options: XIVAPIOptions;
82+
private readonly endpoint: string;
83+
private readonly globalParams: { [key: string]: string | number };
11184

11285
constructor(options: string | XIVAPIOptions);
11386
constructor(options: string | XIVAPIOptions, legacyOptions?: XIVAPIOptions);
@@ -125,7 +98,10 @@ declare module "@xivapi/js" {
12598
* await xiv.search("aiming", { indexes: ["Item", "Recipe"] }); // with params
12699
* ```
127100
*/
128-
public search(input: string, params?: DataSearchParams): Promise<SearchResult>;
101+
public search(
102+
input: keyof typeof SearchIndexes,
103+
params?: DataSearchParams
104+
): Promise<SearchIndexResult>;
129105

130106
/**
131107
* Obtain game content data of Final Fantasy XIV.
@@ -157,8 +133,8 @@ declare module "@xivapi/js" {
157133
* ```
158134
*/
159135
list: (
160-
name: string,
161-
params: {
136+
name: keyof typeof SearchIndexes,
137+
params?: {
162138
/**
163139
* Limit the number of items returned by the API.
164140
* @min 100
@@ -171,7 +147,7 @@ declare module "@xivapi/js" {
171147
*/
172148
ids?: number[];
173149
}
174-
) => Promise<SearchResult>;
150+
) => Promise<SearchIndexResult>;
175151

176152
/**
177153
* Returns information about a specific object including extended information.

typings/utils/achievements.d.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@ export interface AchievementsData {
66
Points: number;
77
}
88

9-
export interface AchievementsSearchResult extends SearchResult {
10-
Results: { ID: number; Icon: string; Name: string; Url: string }[];
11-
}
12-
139
export interface AchievementCategoryData {
1410
AchievementsKind: {
1511
ID: number;

typings/utils/freecompany.d.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,13 @@ export interface FreeCompanyGetParams {
1414
data?: ["FCM"];
1515
}
1616

17-
export interface BasicFreeCompanyData {
18-
Crest: string[];
19-
ID: string;
20-
Name: string;
21-
Server: string;
22-
}
23-
2417
export interface FreeCompanySearchResult extends SearchResult {
25-
Results: BasicFreeCompanyData[];
18+
Results: {
19+
Crest: string[];
20+
ID: string;
21+
Name: string;
22+
Server: string;
23+
}[];
2624
}
2725

2826
export interface FreeCompanyGetResult {

typings/utils/linkshell.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,13 @@ import { SearchParams, SearchResult } from "./search";
33

44
export interface LinkshellSearchParams extends SearchParams {}
55

6-
export interface BasicLinkshellData {
7-
Crest: string[];
8-
ID: string;
9-
Name: string;
10-
Server: string;
11-
}
12-
136
export interface LinkshellSearchResult extends SearchResult {
14-
Results: BasicLinkshellData[];
7+
Results: {
8+
Crest: string[];
9+
ID: string;
10+
Name: string;
11+
Server: string;
12+
}[];
1513
}
1614

1715
export interface LinkshellGetResult {

typings/utils/pvpteam.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,13 @@ import { SearchParams, SearchResult } from "./search";
33

44
export interface PvPTeamSearchParams extends SearchParams {}
55

6-
export interface BasicPvPTeamData {
7-
Crest: string[];
8-
ID: string;
9-
Name: string;
10-
Server: string;
11-
}
12-
136
export interface PvPTeamSearchResult extends SearchResult {
14-
Results: BasicPvPTeamData[];
7+
Results: {
8+
Crest: string[];
9+
ID: string;
10+
Name: string;
11+
Server: string;
12+
}[];
1513
}
1614

1715
export interface PvPTeamGetResult {

typings/utils/search.d.ts

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,34 @@
1+
export enum SearchIndexes {
2+
"Achievement",
3+
"Title",
4+
"Action",
5+
"CraftAction",
6+
"Trait",
7+
"PvPAction",
8+
"PvPTrait",
9+
"Status",
10+
"BNpcName",
11+
"ENpcResident",
12+
"Companion",
13+
"Mount",
14+
"Leve",
15+
"Emote",
16+
"InstanceContent",
17+
"Item",
18+
"Recipe",
19+
"Fate",
20+
"Quest",
21+
"ContentFinderCondition",
22+
"Balloon",
23+
"BuddyEquip",
24+
"Orchestrion",
25+
"PlaceName",
26+
"Weather",
27+
"World",
28+
"Map",
29+
"lore_finder",
30+
}
31+
132
export interface SearchResult {
233
/**
334
* The pagination data for the search.
@@ -18,8 +49,12 @@ export interface SearchResult {
1849
Results: unknown[];
1950
}
2051

52+
export interface SearchIndexResult extends SearchResult {
53+
Results: { ID: number; Icon: string | null; Name: string | null; Url: string }[];
54+
}
55+
2156
interface SearchParams {
22-
/**
57+
/**-
2358
* The name to search for, you can use `+` for spaces or let the API handle it for you.
2459
*/
2560
name?: string;

0 commit comments

Comments
 (0)