@@ -47,13 +47,20 @@ export class XivapiService {
4747 * @param allLanguages should it include Text_*?
4848 * @param dataColumns Additional data you want to fetch.
4949 * @param page data page to get
50+ * @param options Options of the request.
5051 */
5152 public searchLore ( query : string , lang : string = 'en' , allLanguages : boolean = false ,
52- dataColumns : string [ ] = [ ] , page : number = 1 ) : Observable < LoreSearchResult > {
53- let httpParams : HttpParams = new HttpParams ( )
54- . set ( 'string' , query )
55- . set ( 'language' , lang )
56- . set ( 'page' , page . toString ( ) ) ;
53+ dataColumns : string [ ] = [ ] , page : number = 1 , options : XivapiOptions = { } ) : Observable < LoreSearchResult > {
54+ if ( ! options . extraQueryParams ) {
55+ options . extraQueryParams = { } ;
56+ }
57+
58+ Object . assign ( options . extraQueryParams , {
59+ string : query ,
60+ language : lang ,
61+ page : page . toString ( )
62+ } ) ;
63+
5764 if ( dataColumns && dataColumns . length > 0 ) {
5865 const columns : string [ ] = [
5966 'Context' ,
@@ -65,9 +72,10 @@ export class XivapiService {
6572 if ( allLanguages ) {
6673 columns . push ( 'Text_*' ) ;
6774 }
68- httpParams = httpParams . set ( 'columns' , columns . join ( ',' ) ) ;
75+
76+ options . extraQueryParams . columns = columns . join ( ',' ) ;
6977 }
70- return this . doGet < LoreSearchResult > ( ` ${ XivapiService . API_BASE_URL } /lore` , httpParams ) ;
78+ return this . request < LoreSearchResult > ( ' /lore' , options ) ;
7179 }
7280
7381 /**
0 commit comments