@@ -2,7 +2,35 @@ import { Assets, Sheet, Sheets, Versions } from "./lib"
22import { CustomError , request } from "./utils"
33
44export default class XIVAPI {
5- private readonly options : XIVAPI . Options
5+ public readonly options : XIVAPI . Options
6+
7+ public readonly achievements : Sheet < "Achievement" >
8+ public readonly minions : Sheet < "Companion" >
9+ public readonly mounts : Sheet < "Mount" >
10+ public readonly items : Sheet < "Item" >
11+
12+ /**
13+ * Raw endpoints for the API. Please consider using the typed endpoints instead.
14+ * @see https://v2.xivapi.com/api/docs
15+ * @since 0.5.0
16+ */
17+ public readonly data = {
18+ /**
19+ * @see https://v2.xivapi.com/api/docs#tag/sheets
20+ * @since 0.5.0
21+ */
22+ sheets : ( ) => new Sheets ( this . options ) ,
23+ /**
24+ * @see https://v2.xivapi.com/api/docs#tag/versions
25+ * @since 0.5.0
26+ */
27+ versions : ( ) => new Versions ( ) . all ( ) . then ( ( versions ) => versions . versions . map ( ( version ) => version . names [ 0 ] ) ) ,
28+ /**
29+ * @see https://v2.xivapi.com/api/docs#tag/assets
30+ * @since 0.5.0
31+ */
32+ assets : ( ) => new Assets ( ) ,
33+ }
634
735 /**
836 * A wrapper for the XIVAPI v2 API.
@@ -17,35 +45,12 @@ export default class XIVAPI {
1745 verbose : false ,
1846 }
1947 ) {
20- this . options = options
21- }
22-
23- /**
24- * @since 0.5.0
25- */
26- public get achievements ( ) {
27- return new Sheet ( "Achievement" )
28- }
29-
30- /**
31- * @since 0.5.0
32- */
33- public get minions ( ) {
34- return new Sheet ( "Companion" )
35- }
48+ this . achievements = new Sheet ( "Achievement" )
49+ this . minions = new Sheet ( "Companion" )
50+ this . mounts = new Sheet ( "Mount" )
51+ this . items = new Sheet ( "Item" )
3652
37- /**
38- * @since 0.5.0
39- */
40- public get mounts ( ) {
41- return new Sheet ( "Mount" )
42- }
43-
44- /**
45- * @since 0.5.0
46- */
47- public get items ( ) {
48- return new Sheet ( "Item" )
53+ this . options = options
4954 }
5055
5156 /**
@@ -63,32 +68,6 @@ export default class XIVAPI {
6368 if ( errors ) throw new CustomError ( errors [ 0 ] . message )
6469 return data as Models . SearchResponse
6570 }
66-
67- /**
68- * Raw endpoints for the API. Please consider using the typed endpoints instead.
69- * @see https://v2.xivapi.com/api/docs
70- * @since 0.5.0
71- */
72- public data = {
73- /**
74- * @see https://v2.xivapi.com/api/docs#tag/assets
75- * @since 0.5.0
76- */
77- assets : ( ) => new Assets ( ) ,
78-
79- /**
80- * @see https://v2.xivapi.com/api/docs#tag/sheets
81- * @since 0.5.0
82- */
83- sheets : ( ) => new Sheets ( this . options ) ,
84-
85- /**
86- * @see https://v2.xivapi.com/api/docs#tag/versions
87- * @since 0.5.0
88- */
89- versions : ( ) =>
90- new Versions ( ) . all ( ) . then ( ( versions ) => versions . versions . map ( ( version ) => version . names [ 0 ] ) ) ,
91- }
9271}
9372
9473export namespace XIVAPI {
0 commit comments