@@ -7,6 +7,7 @@ const SharedCredentials = require("./SharedCredentials");
77const CustomHeaderSender = require ( "./CustomHeaderSender" ) ;
88const StatusCodeSender = require ( "./StatusCodeSender" ) ;
99const LicenseSender = require ( "./LicenseSender" ) ;
10+ const CustomQuerySender = require ( "@/src/CustomQuerySender" ) ;
1011const BadCredentialsError = require ( "./Errors" ) . BadCredentialsError ;
1112const RetrySender = require ( "./RetrySender" ) ;
1213const Sleeper = require ( "./util/Sleeper.ts" ) ;
@@ -50,6 +51,7 @@ class ClientBuilder {
5051 this . customHeaders = { } ;
5152 this . debug = undefined ;
5253 this . licenses = [ ] ;
54+ this . customQueries = new Map ( ) ;
5355
5456 function noCredentialsProvided ( ) {
5557 return ( ! signer ) instanceof StaticCredentials || ( ! signer ) instanceof SharedCredentials ;
@@ -152,6 +154,42 @@ class ClientBuilder {
152154 return this ;
153155 }
154156
157+ /**
158+ * Allows the caller to specify key and value pair that is added to the request
159+ * @param {string } key - The query parameter key
160+ * @param {string } value - The query parameter value
161+ * @return Returns <b>this</b> to accommodate method chaining.
162+ */
163+ withCustomQuery ( key , value ) {
164+ this . customQueries . set ( key , value ) ;
165+
166+ return this ;
167+ }
168+
169+ /**
170+ * Allows the caller to specify key and value pair and appends the value associated with the key, seperated by a comma.
171+ * @param {string } key - The query parameter key
172+ * @param {string } value - The query parameter value
173+ * @return Returns <b>this</b> to accommodate method chaining.
174+ */
175+ withCustomCommaSeperatedQuery ( key , value ) {
176+ let values = this . customQueries . get ( key ) ;
177+ if ( values === "" ) {
178+ values = value ;
179+ } else {
180+ values += "," + value ;
181+ }
182+ this . customQueries . set ( key , values ) ;
183+ }
184+
185+ /**
186+ * Adds to the request query to use the component analysis feature.
187+ * @return Returns <b>this</b> to accommodate method chaining.
188+ */
189+ withFeatureComponentAnalysis ( ) {
190+ return this . withCustomCommaSeperatedQuery ( "features" , "component-analysis" ) ;
191+ }
192+
155193 buildSender ( ) {
156194 if ( this . httpSender ) return this . httpSender ;
157195
@@ -166,8 +204,9 @@ class ClientBuilder {
166204 const customHeaderSender = new CustomHeaderSender ( agentSender , this . customHeaders ) ;
167205 const baseUrlSender = new BaseUrlSender ( customHeaderSender , this . baseUrl ) ;
168206 const licenseSender = new LicenseSender ( baseUrlSender , this . licenses ) ;
207+ const customQuerySender = new CustomQuerySender ( licenseSender , this . customQueries ) ;
169208
170- return licenseSender ;
209+ return customQuerySender ;
171210 }
172211
173212 buildClient ( baseUrl , Client ) {
0 commit comments