@@ -42,9 +42,9 @@ export interface GetContentByIdParams {
42
42
43
43
/** Returns a content item referenced by id */
44
44
export function getContentById ( http : HttpClient , params : GetContentByIdParams ) : Promise < ServerResponse < ContentItemPublicContract > > {
45
- return get ( http , ` ${ API_BASE } GetContentById/ ${ params . id } / ${ params . locale } /` , {
46
- head : params . head
47
- } ) ;
45
+ const strParams : Record < string , string > = { } ;
46
+ if ( params . head !== undefined ) { strParams . head = params . head . toString ( ) ; }
47
+ return get ( http , ` ${ API_BASE } GetContentById/ ${ params . id } / ${ params . locale } /` , strParams ) ;
48
48
}
49
49
50
50
export interface GetContentByTagAndTypeParams {
@@ -57,9 +57,9 @@ export interface GetContentByTagAndTypeParams {
57
57
58
58
/** Returns the newest item that matches a given tag and Content Type. */
59
59
export function getContentByTagAndType ( http : HttpClient , params : GetContentByTagAndTypeParams ) : Promise < ServerResponse < ContentItemPublicContract > > {
60
- return get ( http , ` ${ API_BASE } GetContentByTagAndType/ ${ params . tag } / ${ params . type } / ${ params . locale } /` , {
61
- head : params . head
62
- } ) ;
60
+ const strParams : Record < string , string > = { } ;
61
+ if ( params . head !== undefined ) { strParams . head = params . head . toString ( ) ; }
62
+ return get ( http , ` ${ API_BASE } GetContentByTagAndType/ ${ params . tag } / ${ params . type } / ${ params . locale } /` , strParams ) ;
63
63
}
64
64
65
65
export interface SearchContentWithTextParams {
@@ -83,14 +83,14 @@ export interface SearchContentWithTextParams {
83
83
* and text search capabilities.
84
84
*/
85
85
export function searchContentWithText ( http : HttpClient , params : SearchContentWithTextParams ) : Promise < ServerResponse < SearchResultOfContentItemPublicContract > > {
86
- return get ( http , ` ${ API_BASE } Search/ ${ params . locale } /` , {
87
- ctype : params . ctype ,
88
- currentpage : params . currentpage ,
89
- head : params . head ,
90
- searchtext : params . searchtext ,
91
- source : params . source ,
92
- tag : params . tag
93
- } ) ;
86
+ const strParams : Record < string , string > = { } ;
87
+ if ( params . ctype !== undefined ) { strParams . ctype = params . ctype ; }
88
+ if ( params . currentpage !== undefined ) { strParams . currentpage = params . currentpage . toString ( ) ; }
89
+ if ( params . head !== undefined ) { strParams . head = params . head . toString ( ) ; }
90
+ if ( params . searchtext !== undefined ) { strParams . searchtext = params . searchtext ; }
91
+ if ( params . source !== undefined ) { strParams . source = params . source ; }
92
+ if ( params . tag !== undefined ) { strParams . tag = params . tag ; }
93
+ return get ( http , ` ${ API_BASE } Search/ ${ params . locale } /` , strParams ) ;
94
94
}
95
95
96
96
export interface SearchContentByTagAndTypeParams {
@@ -107,11 +107,11 @@ export interface SearchContentByTagAndTypeParams {
107
107
108
108
/** Searches for Content Items that match the given Tag and Content Type. */
109
109
export function searchContentByTagAndType ( http : HttpClient , params : SearchContentByTagAndTypeParams ) : Promise < ServerResponse < SearchResultOfContentItemPublicContract > > {
110
- return get ( http , ` ${ API_BASE } SearchContentByTagAndType/ ${ params . tag } / ${ params . type } / ${ params . locale } /` , {
111
- currentpage : params . currentpage ,
112
- head : params . head ,
113
- itemsperpage : params . itemsperpage
114
- } ) ;
110
+ const strParams : Record < string , string > = { } ;
111
+ if ( params . currentpage !== undefined ) { strParams . currentpage = params . currentpage . toString ( ) ; }
112
+ if ( params . head !== undefined ) { strParams . head = params . head . toString ( ) ; }
113
+ if ( params . itemsperpage !== undefined ) { strParams . itemsperpage = params . itemsperpage . toString ( ) ; }
114
+ return get ( http , ` ${ API_BASE } SearchContentByTagAndType/ ${ params . tag } / ${ params . type } / ${ params . locale } /` , strParams ) ;
115
115
}
116
116
117
117
export interface SearchHelpArticlesParams {
@@ -135,8 +135,8 @@ export interface RssNewsArticlesParams {
135
135
136
136
/** Returns a JSON string response that is the RSS feed for news articles. */
137
137
export function rssNewsArticles ( http : HttpClient , params : RssNewsArticlesParams ) : Promise < ServerResponse < NewsArticleRssResponse > > {
138
- return get ( http , ` ${ API_BASE } Rss/NewsArticles/ ${ params . pageToken } /` , {
139
- categoryfilter : params . categoryfilter ,
140
- includebody : params . includebody
141
- } ) ;
138
+ const strParams : Record < string , string > = { } ;
139
+ if ( params . categoryfilter !== undefined ) { strParams . categoryfilter = params . categoryfilter ; }
140
+ if ( params . includebody !== undefined ) { strParams . includebody = params . includebody . toString ( ) ; }
141
+ return get ( http , ` ${ API_BASE } Rss/NewsArticles/ ${ params . pageToken } /` , strParams ) ;
142
142
}
0 commit comments