@dmgt/google-ad-manager-api
Version:
Typed Google Ad Manager API
40 lines • 948 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getByStatement = getByStatement;
const pql_1 = require("./pql");
/**
* Query a service wth PQL options.
*
* If a client's method matches that of a usual query statement,
* using this function will infer the query object.
*
* @example
* ```
* getByStatement(client, 'lineItems', {
* where: {
* id: 123
* }
* })
* ```
* Is syntactical sugar for:
* ```
* client.getLineItemsByStatementAsync({
* filterStatement: {
* query: pql<LineItems>({
* where: {
* id: 123
* }
* })
* }
* })
* ```
*/
function getByStatement(client, service, query, values, ...args) {
return client[`get${service[0].toUpperCase()}${service.slice(1)}ByStatementAsync`]({
filterStatement: {
query: (0, pql_1.pql)(query),
values,
},
}, ...args);
}
//# sourceMappingURL=statement.js.map