1- import Base , { Options , QueryReturns } from './Base' ;
1+ import Base , { Options , APIResponse } from './Base' ;
22
33export type Query = Array < string > | string ;
44
@@ -7,7 +7,7 @@ export interface E6Options extends Options {
77 overrideTags ?: string ;
88}
99
10- async function E6Base ( endpoint : string , query ?: Query , options ?: E6Options ) : QueryReturns {
10+ async function E6Base ( endpoint : string , query ?: Query , options ?: E6Options ) : APIResponse {
1111 if ( typeof query === 'undefined' ) query = '' ;
1212 if ( Array . isArray ( query ) ) query = query . join ( ' ' )
1313 const base = new Base ( options ) ;
@@ -19,12 +19,37 @@ async function E6Base(endpoint: string, query?: Query, options?: E6Options): Que
1919 return await base . query ( url , r => r . data ?. posts [ 0 ] ) ;
2020}
2121
22- export default Base . bundle ( E6Base , {
22+ /**
23+ * Uses the E621 API to retrieve data of a random post {@link https://e621.net}
24+ * @param options - Library options
25+ * @returns - The response from the API
26+ */
27+ declare function E621 ( options ?: Options ) : APIResponse ;
28+
29+ /**
30+ * Uses the E926 API to retrieve data of a random post {@link https://e926.net}
31+ * @param options - Library options
32+ * @returns - The response from the API
33+ */
34+ declare function E926 ( options ?: Options ) : APIResponse ;
35+
36+ export declare interface E6 {
37+ /**
38+ * Uses the E621 API to retrieve data of a random post {@link https://e621.net}
39+ * @param options - Library options
40+ * @returns - The response from the API
41+ */
42+ ( options ?: Options ) : APIResponse ;
43+ nsfw : typeof E621 ;
44+ sfw : typeof E926 ;
45+ }
46+
47+ export default < E6 > Base . bundle ( E6Base , {
2348 nsfw : 'e621' ,
2449 sfw : 'e926'
2550} , {
2651 default : ( name ) => {
27- return async function ( query : Query , options ?: E6Options ) : QueryReturns {
52+ return async function ( query : Query , options ?: E6Options ) : APIResponse {
2853 return await E6Base ( name , query , options )
2954 }
3055 }
0 commit comments