UNPKG

@azure/cosmos

Version:
68 lines (67 loc) 2.27 kB
var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); var Offers_exports = {}; __export(Offers_exports, { Offers: () => Offers }); module.exports = __toCommonJS(Offers_exports); var import_common = require("../../common/index.js"); var import_queryIterator = require("../../queryIterator.js"); class Offers { /** * @hidden * @param client - The parent {@link CosmosClient} for the offers. */ constructor(client, clientContext) { this.client = client; this.clientContext = clientContext; } query(query, options) { return new import_queryIterator.QueryIterator(this.clientContext, query, options, (diagnosticNode, innerOptions) => { return this.clientContext.queryFeed({ path: "/offers", resourceType: import_common.ResourceType.offer, resourceId: "", resultFn: (result) => result.Offers, query, options: innerOptions, diagnosticNode }); }); } /** * Read all offers. * @example Read all offers to array. * ```ts snippet:OffersReadAll * import { CosmosClient } from "@azure/cosmos"; * * const endpoint = "https://your-account.documents.azure.com"; * const key = "<database account masterkey>"; * const client = new CosmosClient({ endpoint, key }); * * const { resources: offerList } = await client.offers.readAll().fetchAll(); * ``` */ readAll(options) { return this.query(void 0, options); } } // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { Offers });