// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../../core/resource'; import { APIPromise } from '../../../core/api-promise'; import { RequestOptions } from '../../../internal/request-options'; import { path } from '../../../internal/utils/path'; export class BaseAdvertisements extends APIResource { static override readonly _key: readonly ['magicNetworkMonitoring', 'rules', 'advertisements'] = Object.freeze(['magicNetworkMonitoring', 'rules', 'advertisements'] as const); /** * Update advertisement for rule. * * @example * ```ts * const advertisement = * await client.magicNetworkMonitoring.rules.advertisements.edit( * '2890e6fa406311ed9b5a23f70f6fb8cf', * { * account_id: '6f91088a406011ed95aed352566e8d4c', * body: {}, * }, * ); * ``` */ edit( ruleID: string, params: AdvertisementEditParams, options?: RequestOptions, ): APIPromise { const { account_id, body } = params; return ( this._client.patch(path`/accounts/${account_id}/mnm/rules/${ruleID}/advertisement`, { body: body, ...options, }) as APIPromise<{ result: Advertisement | null }> )._thenUnwrap((obj) => obj.result); } } export class Advertisements extends BaseAdvertisements {} export interface Advertisement { /** * Toggle on if you would like Cloudflare to automatically advertise the IP * Prefixes within the rule via Magic Transit when the rule is triggered. Only * available for users of Magic Transit. */ automatic_advertisement: boolean | null; } export interface AdvertisementEditParams { /** * Path param */ account_id: string; /** * Body param */ body: unknown; } export declare namespace Advertisements { export { type Advertisement as Advertisement, type AdvertisementEditParams as AdvertisementEditParams }; }