Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public buildSearchRequest(
customer_id: string,
query: string,
page_size?: number,
page_token?: string
): BuildSearchRequestResponse {
const request = new SearchGoogleAdsRequest()
request.setCustomerId(customer_id)
request.setQuery(query)
if (page_size) {
request.setPageSize(page_size)
}
if (page_token) {
request.setPageToken(page_token)
}
const has_limit = query.toLowerCase().includes(' limit ')
let limit = 0 // The default limit is 0, which means no limit.
if (has_limit) {
limit = +query
.toLowerCase()
.split(' limit ')[1]