Udostępnij przez


Offer class

Użyj polecenia , aby odczytać lub zamienić istniejącą ofertę według identyfikatora.

Zobacz Oferty do wykonywania zapytań lub odczytywania wszystkich ofert.

Właściwości

client
id
url

Zwraca adres URL odwołania do zasobu. Służy do łączenia w obszarze Uprawnienia.

Metody

read(RequestOptions)

Przeczytaj OfferDefinition dla danej oferty .

Przykład

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)

Zastąp podane oferty określonym OfferDefinition.

Przykład

Zastąp ofertę nową definicją oferty ze zaktualizowaną przepływnością

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);

Szczegóły właściwości

client

client: CosmosClient

Wartość właściwości

id

id: string

Wartość właściwości

string

url

Zwraca adres URL odwołania do zasobu. Służy do łączenia w obszarze Uprawnienia.

string url

Wartość właściwości

string

Szczegóły metody

read(RequestOptions)

Przeczytaj OfferDefinition dla danej oferty .

Przykład

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

Zwraca

Promise<OfferResponse>

replace(OfferDefinition, RequestOptions)

Zastąp podane oferty określonym OfferDefinition.

Przykład

Zastąp ofertę nową definicją oferty ze zaktualizowaną przepływnością

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

Zwraca

Promise<OfferResponse>