Sdílet prostřednictvím


Offer class

Slouží ke čtení nebo nahrazení existující nabídky podle ID.

Podívejte se na Nabídky dotazování nebo čtení všech nabídek.

Vlastnosti

client
id
url

Vrátí adresu URL odkazu na prostředek. Používá se pro propojení v oprávněních.

Metody

read(RequestOptions)

Přečtěte si OfferDefinition pro danou nabídku.

Příklad

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 { resource: offer } = await client.offer("<offer-id>").read();
replace(OfferDefinition, RequestOptions)

Nahraďte danou nabídku zadanou OfferDefinition.

Příklad

Nahradit nabídku novou definicí nabídky s aktualizovanou propustností

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 { resource: offer } = await client.offer("<offer-id>").read();
// @ts-preservewhitespace
offer.content.offerThroughput = 1000;
await client.offer("<offer-id>").replace(offer);

Podrobnosti vlastnosti

client

client: CosmosClient

Hodnota vlastnosti

id

id: string

Hodnota vlastnosti

string

url

Vrátí adresu URL odkazu na prostředek. Používá se pro propojení v oprávněních.

string url

Hodnota vlastnosti

string

Podrobnosti metody

read(RequestOptions)

Přečtěte si OfferDefinition pro danou nabídku.

Příklad

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 { resource: offer } = await client.offer("<offer-id>").read();
function read(options?: RequestOptions): Promise<OfferResponse>

Parametry

options
RequestOptions

Návraty

Promise<OfferResponse>

replace(OfferDefinition, RequestOptions)

Nahraďte danou nabídku zadanou OfferDefinition.

Příklad

Nahradit nabídku novou definicí nabídky s aktualizovanou propustností

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 { resource: offer } = await client.offer("<offer-id>").read();
// @ts-preservewhitespace
offer.content.offerThroughput = 1000;
await client.offer("<offer-id>").replace(offer);
function replace(body: OfferDefinition, options?: RequestOptions): Promise<OfferResponse>

Parametry

options
RequestOptions

Návraty

Promise<OfferResponse>