مشاركة عبر


Offer class

يستخدم لقراءة عرض موجود أو استبداله حسب المعرف.

راجع العروض للاستعلام عن جميع العروض أو قراءتها.

الخصائص

client
id
url

إرجاع URL مرجع إلى المورد. يستخدم للارتباط في الأذونات.

الأساليب

read(RequestOptions)

اقرأ offerDefinition لعرض المحدد.

مثال

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)

استبدل عرض المحدد المحددOfferDefinition .

مثال

استبدال العرض بتعريف عرض جديد بمعدل نقل محدث

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

تفاصيل الخاصية

client

client: CosmosClient

قيمة الخاصية

id

id: string

قيمة الخاصية

string

url

إرجاع URL مرجع إلى المورد. يستخدم للارتباط في الأذونات.

string url

قيمة الخاصية

string

تفاصيل الأسلوب

read(RequestOptions)

اقرأ offerDefinition لعرض المحدد.

مثال

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>

المعلمات

options
RequestOptions

المرتجعات

Promise<OfferResponse>

replace(OfferDefinition, RequestOptions)

استبدل عرض المحدد المحددOfferDefinition .

مثال

استبدال العرض بتعريف عرض جديد بمعدل نقل محدث

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>

المعلمات

body
OfferDefinition

offerDefinition المحدد

options
RequestOptions

المرتجعات

Promise<OfferResponse>