@@ -64,6 +64,12 @@ export interface Config {
6464 * String map specifying default headers
6565 */
6666 header : Header ;
67+ /**
68+ * Append tags to helper requests like `lookupPostcode` and `lookupUDPRN`
69+ *
70+ * Tags attached to the client are overwritten on an request if it is also specified in the helper request options
71+ */
72+ tags : string [ ] ;
6773}
6874
6975interface Defaults {
@@ -170,6 +176,7 @@ export class Client {
170176 readonly timeout : number ;
171177 readonly agent : Agent ;
172178 readonly header : Header ;
179+ readonly tags : string [ ] ;
173180 readonly postcodes : PostcodeResource ;
174181 readonly addresses : AddressResource ;
175182 readonly udprn : UdprnResource ;
@@ -187,6 +194,7 @@ export class Client {
187194 this . strictAuthorisation = config . strictAuthorisation ;
188195 this . timeout = config . timeout ;
189196 this . agent = config . agent ;
197+ this . tags = config . tags ;
190198 this . header = { ...Client . defaults . header , ...config . header } ;
191199 this . postcodes = createPostcodeResource ( this ) ;
192200 this . addresses = createAddressResource ( this ) ;
@@ -262,7 +270,7 @@ export class Client {
262270 appendAuthorization ( { client : this , header, options } ) ;
263271 appendIp ( { header, options } ) ;
264272 appendFilter ( { query, options } ) ;
265- appendTags ( { query, options } ) ;
273+ appendTags ( { client : this , query, options } ) ;
266274 appendPage ( { query, options } ) ;
267275
268276 const queryOptions : Request = { header, query } ;
@@ -287,7 +295,7 @@ export class Client {
287295 appendAuthorization ( { client : this , header, options } ) ;
288296 appendIp ( { header, options } ) ;
289297 appendFilter ( { query, options } ) ;
290- appendTags ( { query, options } ) ;
298+ appendTags ( { client : this , query, options } ) ;
291299
292300 const request : Request = { header, query } ;
293301 if ( options . timeout !== undefined ) request . timeout = options . timeout ;
0 commit comments