// 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 { buildHeaders } from '../../internal/headers';
import { RequestOptions } from '../../internal/request-options';
import { path } from '../../internal/utils/path';

export class BaseEmbed extends APIResource {
  static override readonly _key: readonly ['stream', 'embed'] = Object.freeze(['stream', 'embed'] as const);

  /**
   * Fetches the legacy HTML code snippet to embed a video in a web page delivered
   * through Cloudflare. On success, returns an HTML fragment for use on web pages to
   * display a video. On failure, returns a JSON response body.
   *
   * @example
   * ```ts
   * const embed = await client.stream.embed.get(
   *   'ea95132c15732412d22c1476fa83f27a',
   *   { account_id: '023e105f4ecef8ad9ca31a8372d0c353' },
   * );
   * ```
   */
  get(identifier: string, params: EmbedGetParams, options?: RequestOptions): APIPromise<string> {
    const { account_id } = params;
    return this._client.get(path`/accounts/${account_id}/stream/${identifier}/embed`, {
      ...options,
      headers: buildHeaders([{ Accept: 'text/html' }, options?.headers]),
    });
  }
}
export class Embed extends BaseEmbed {}

export type EmbedGetResponse = string;

export interface EmbedGetParams {
  /**
   * The account identifier tag.
   */
  account_id: string;
}

export declare namespace Embed {
  export { type EmbedGetResponse as EmbedGetResponse, type EmbedGetParams as EmbedGetParams };
}
